URL Question |
[eluser]Unknown[/eluser]
I have an application that I've written that uses a controller called app, but I'd like the URL that is presented to the user to be simply /a instead of /app I've tried adjusting routes as well as entries in my .htaccess, but I just can't seem to make it work as I'd like. Can someone point me in a direction?
[eluser]timpiele[/eluser]
Try adding this to your routes: $route['a/'] = "app/index"; and then make any links as just www.example.com/a which should redirect to the app controller, index method.
[eluser]CroNiX[/eluser]
This will only work if the url is exactly http://yoursite.com/a If you want it to work with additional parameters, like http://yoursite/a/foo you need additional routes, but you only mentioned wanting /a to go to /app. Code: $route['a'] = 'app'; //a => app/index (index is automatic if excluded and only 1 segment in the destination)
[eluser]Aken[/eluser]
Code: $route['a/(:any)'] = 'app/$1';
[eluser]Unknown[/eluser]
cannot believe it was that easy. I had been doing the $route['a/(:any)'] = 'app/$1' but that wasn't getting the index. Thanks for the help. |
Welcome Guest, Not a member yet? Register Sign In |