0

Well I'm not really sure how you guys implement mod_rewrite with codeigniter, and I'm not even sure If I need to do that right now. What I want is to get rid of the index.php that trails the root directory, so eliminate it from www.mydomain.com/index.php/mycontroller and just have www.mydomain.com/mycontroller/

2

3 Answers 3

4

In addition to what everyone above said about .htaccess, you also have to set

$config['index_page'] = 'index.php';

to

$config['index_page'] = '';

in your /application/config/config.php file

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

Comments

2

You can hide your index.php by modifying your .htaccess file. For example,

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

You can find out more about CodeIgniter URLs here: http://codeigniter.com/user_guide/general/urls.html

Comments

-1

you can place this in .htaccess to remove index.php from url

    #### Remove index.php ###
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    #### index.php ###

1 Comment

This does not work in CI3, not sure about CI2 (but probably not). See solution below by Dan Teesdale for a working solution for CI3. You will also need to make the changes suggested by nageeb below. If your using apache you also need to enable mod_rewrite

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.