Welcome Guest, Not a member yet? Register   Sign In
how to remove index.php from urls?
#1

[eluser]Abel A.[/eluser]
Currently CI supports:
domain.com/index.php/controller1
domain.com/controller1

I only want to use the second version of the urls. When I set the index in the config to '' my urls get redirected to domain.com/?/controller1 for ever time I use the redirect function.

I'm ok having the index.php there actually. My issue is that I started using:
Code:
redirect('/controller1', 'location');

and my urls goes to domain.com/index.php?/controller1 instead of domain.com/controller1

Any ideas how I can cater this to my liking?

Note: I'm using nginx
#2

[eluser]weboap[/eluser]
do some search in the forum before posting
your answer :
http://ellislab.com/forums/viewthread/217607/
#3

[eluser]Abel A.[/eluser]
Those answers didn't help because I use nginx.
#4

[eluser]Abel A.[/eluser]
It took me a while to figure it out, but for those that wonder into this thread...

I had to edit my config to the following:
Code:
$config['index_page'] = '';
$config['enable_query_strings'] = FALSE;

Setting the index_page to blank will prevent the redirect function from adding index.php and the enable_query_strings to false prevents the redirect function from adding the question mark to the url. I think this is a tiny bug in CI.
#5

[eluser]Aken[/eluser]
Setting index_page to blank is what you're supposed to do when removing index.php from your URLs. enable_query_strings is false by default, because most often it will not be used. So not a bug, just a mis-configuration which you discovered and solved.




Theme © iAndrew 2016 - Forum software by © MyBB