CodeIgniter Forums
Unexpected routing behaviour - 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: Unexpected routing behaviour (/showthread.php?tid=50328)



Unexpected routing behaviour - El Forum - 03-22-2012

[eluser]GreGre[/eluser]
I am posting this because I could not find if such question was already answered or even asked.

Here's my problem
I have a route directive

Code:
$route["desk/(:any)"] = "$1";

I am expecting the following behaviour:
the url desk/controller/method should be the same as controller/method

But instead, I get a 404.

Any ideas why?


Unexpected routing behaviour - El Forum - 03-22-2012

[eluser]CroNiX[/eluser]
Try capturing the controller and method separately:
Code:
$route["desk/(.*)/(.*)"] = "$1/$2";  //covers desk/controller/method
$route["desk/(.*)"] = "$1";          //covers desk/controller, will route to controller/index



Unexpected routing behaviour - El Forum - 03-23-2012

[eluser]GreGre[/eluser]
Thanks for the answer. It didnt work though.

The funy part is, this works as expected:
Code:
$route["p/(:any)"] = "page/display/$1";
regardless of the number of arguments submitted after p/

Maybe any idea on how to debug this? The 404 error is not much of a help. I'd like to now what (non existing) controller is actually called. I would then be able to debug it myself.