Case Insensitive Routes In CakePHP 1.2RC3
Posted by on Wed, Nov 12 2008
I wrote a post awhile back on how to do case insensitive routing in CakePHP. The method described there doesn't work anymore. The Cake Router now interprets the ":" character as the beginning of a named parameter.
An alternate way, which does work in RC3 is to begin your route with (?i), which will tell the regular expression engine to ignore the case for all characters to the right.
If you want to have an "about" page that is linked to by "/aboutâ€, "/Aboutâ€, or "/aBoUt†you can use:
Router::connect(’/(?i)about’, array(’controller’ => ‘pages’, ‘action’ =>’display’, ‘about’));
I don't believe there is way to set this for all routes, but if there is I would love to hear it.
Posted in Code Snippets

2 Comments
Though, why would one prefer a case-sensitive approach is beyond me...
Add new comment