CodeIgniter Forums
route - any - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: route - any (/showthread.php?tid=2090)



route - any - El Forum - 07-16-2007

[eluser]Ericks[/eluser]
Hey,

I want to route every request to one controller.
I tried this but I cant get this to work:

Code:
$route[':any'] = "index";

anything with something before 'any' works just fine (like $route['product/:any'] = "index"Wink, but the above line doesnt. I tried this too

Code:
$route['([a-z]+)'] = "index/$1";

which would be even better for me, but it doesn't work either.

any ideas?


route - any - El Forum - 07-16-2007

[eluser]Glen Swinfield[/eluser]
Probably best to use a .htaccess file.

i.e. when removing index.php (assuming you have) instead of this:

Code:
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

do something like this:

Code:
RewriteRule ^(.*)$ index.php/index/$1 [L,QSA]