Welcome Guest, Not a member yet? Register   Sign In
regex and routing
#1

[eluser]stoefln[/eluser]
i always had my routing config like this:
$route['users/([a-zA-Z0-9]+)'] = "users/profile/$1";

now i like to get rid of the "users" cause this is the main controller and i would like to get the urls as short as possible.
but:
$route['([a-zA-Z0-9]+)'] = "profile/$1";
<b>edit (sorry made a mistake)</b>
$route['([a-zA-Z0-9]+)'] = "users/profile/$1";
<b>edit end</b>
does not work, i get to the wrong profile when i enter the url without "users/"
any ideas?
#2

[eluser]xwero[/eluser]
if you don't want to have users in the url why do you change the controller? In your second route profile is the controller so the method is the fetched username, which gives you 404 errors i assume?
#3

[eluser]stoefln[/eluser]
[quote author="xwero" date="1235596958"]if you don't want to have users in the url why do you change the controller? In your second route profile is the controller so the method is the fetched username, which gives you 404 errors i assume?[/quote]

sorry actually the correct version is:
$route[’([a-zA-Z0-9]+)’] = “users/profile/$1”;

corrected it in the original post.
nevertheless it doesnt work.




Theme © iAndrew 2016 - Forum software by © MyBB