Welcome Guest, Not a member yet? Register   Sign In
Remove Controller from the URI to keep URL Shorter
#1

[eluser]Unknown[/eluser]
Hello.

I want to keep the url's short and have this:

www.example.com / function / ID

so that by default my controller called Main will accept the functions.

My question is:
How can I do this so that I do not have to re-edit the routes.php file when I add another controller?
e.g. in three months time I decide to add an Admin controller

To add
I have my Main controller accepting the functions currently. I'm doing the following which I found here

Code:
$route['^(?!exemptdomians|ezsell|login).*'] = "main/$0";

But this means I have to re-edit this in routes.php whenever I add a controller.

many thanks if you can give any help!
#2

[eluser]pistolPete[/eluser]
You can either add the routes automatically: http://ellislab.com/forums/viewreply/261261/

Or you can extend the Router class and add that functionality there: http://ellislab.com/codeigniter/user-gui...aries.html




Theme © iAndrew 2016 - Forum software by © MyBB