CodeIgniter Forums
Routing Problem - 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: Routing Problem (/showthread.php?tid=31713)



Routing Problem - El Forum - 06-29-2010

[eluser]Vasi[/eluser]
Hi guys,
I used for routing the method from here:
http://ellislab.com/forums/viewthread/146402/#717286

I have no problem when routing like this:
Code:
$route['example_controller/(:any)'] = 'example_controller/$1';

but when I try to add a method like bellow it doesn't work:
Code:
$route['example_controller/method/(:any)'] = 'example_controller/method/$1';

Any help would be appreciate it.
Thanks.


Routing Problem - El Forum - 06-29-2010

[eluser]mddd[/eluser]
You must remember that (:any) can match more than one segment.
So the route
Code:
$route['controller/(:any)'] = 'controller/$1';
will also match the url
Code:
controller/some_method/some_value

The solution is to always put the most specific rule first. If it is not matched, a more general rule might still match.


Routing Problem - El Forum - 06-29-2010

[eluser]LuckyFella73[/eluser]
In a project I use this code and it works fine:
Code:
$route['controller/method/(.*)'] = "de/controller/method/$1";

Hope that helps


Routing Problem - El Forum - 06-30-2010

[eluser]Vasi[/eluser]
Thanks guys,

I changed the order of the rules and it worked. Thanks again.


Routing Problem - El Forum - 03-22-2012

[eluser]Reneesh T K[/eluser]
Hi,

I was also a problem with codeigniter url rewriting.

I have to go to www.abc.com/catalog/product/4354

when using the url www.abc.com/samsung_galaxy_y

I have resolved it using the following from myphplibrary.blogspot.com and it worked fine for me. Check it out.

http://myphplibrary.blogspot.in/2012/03/codeigniter-routing-issue-fixation-url.html