0

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'.
0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.