Reputation: 120
I have a controller admin in my codeigniter project, i don't want users to directly access it like
'localhost://myproject/admin'
I want it to display a 404 error instead.
i want to use
localhost://myproject/something
to load my controller and i don't want to change my controller name, meanwhile my controller name is Admin. is this possible? if it is what a re the possible ways of going about it
my route :
$route['controller/admin'] = 'controller/something'.
Upvotes: 0
Views: 73
Reputation: 597
The left value of the route setting is the part that comes from the URL, the right value is the the one it should get rerouted to.
In your case you would need to swap the strings you chose to:
$route['controller/something'] = 'controller/admin'
But as the controller is named admin, you need to use the following rerouting (following /controller/method/parameter):
$route['something'] = 'admin'
Don't forget to add wildcards.
Here's a link to the routing documentation.
Upvotes: 1