URL Forwarding and CodeIgniter |
[eluser]Eric Cope[/eluser]
I need to forward a web address like this: Code: http://homesite.com/some_text Code: http://homesite.com/CI_class/CI_function/more_data At first I thought to use .htaccess rewrites, however the list of possible values of some_text will be growing/changing/shrinking. That means I would need to regenerate .htaccess every time the list of some_text changes, which does not seem appealing. Does anyone have any ideas?
[eluser]Jelmer[/eluser]
Check routes in the documentation: http://ellislab.com/codeigniter/user-gui...uting.html
[eluser]Eric Cope[/eluser]
It looks like some regular expressions and back references will do it. Additionally, I should route my classes above the regular expressions so they don't get incorrectly translated. Code: $route['^([a-zA-Z0-9\_\-]+)$'] = "class_to_process_route/$1"; That should match only letters, numbers. underscores and dashes. Can someone double check me?
[eluser]Jelmer[/eluser]
if you want to route everything except for a couple of controllers you're right although I'd choose over the regex: Code: $route[':any'] = 'controller'; |
Welcome Guest, Not a member yet? Register Sign In |