regular expression trouble... |
[eluser]danoph[/eluser]
i am trying to route URLS such as http://localhost/contact to http://localhost/home/contact UNLESS $1 is sell or store using the following route. http://localhost/sell and http://localhost/store link to the right controllers, but if the method isn't one of those two, I get a 404 error. I am obviously doing this wrong. Can anyone help me out? $route['!^(sell|store)'] = "home/$1";
[eluser]sophistry[/eluser]
why don't you use multiple routes one for sell and one for store and then use the handy :any shortcut to route everything else. so 3 routing rules in all. does that work?
[eluser]danoph[/eluser]
i found a solution. $route['^(?!store|sell).*'] = "home/$0"; this allows for multiple controllers (store and sell) as well as functions within a certain controller (home) to use simple urls: http://localhost/contact (uses home controller, function contact) http://localhost/sell (uses sell controller) http://localhost/store (uses store controller)
[eluser]danoph[/eluser]
heh, i guess that would have worked also. oh well, i learned a little bit about regular expressions today |
Welcome Guest, Not a member yet? Register Sign In |