[eluser]loosetops[/eluser]
Here is a way to remove the default controller name from the URLS
Say you have a default controller (
home in our case), your URLs will be of this format
Code:
http://website.com/
http://website.com/home/about
http://website.com/home/contact
http://website.com/home/faq
http://website.com/home/resources
To get rid of the default controller name we use the routes file in the config folder. For the above example this would work
Code:
$route['^(about|contact|faq|resources)(/:any)?$'] = "home/$0";
What it does, is it checks if the any of the requested methods match the methods in your default controller. If they do it routes them to the default controller. You have to include all the methods in the default controller class. This is by re-routing by inclusion.
You can now use these URLS
Code:
http://website.com/
http://website.com/aboutus
http://website.com/contact
http://website.com/faq
http://website.com/resources
Another solution would be by exclusion e.g.
Code:
$route['^(?!users|blog|controller3|controller4).*'] = "home/$0";
In the above solution we use names of other controllers and we re-route anything that doesn't match to the default/home controller. You have to exclude the controller names so that their methods/URLS are not re-routed
I prefer the first one.