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/
-
I answered it before, you can look at here: stackoverflow.com/questions/11151477/…ActuallyMAB– ActuallyMAB2012-06-27 07:47:18 +00:00Commented Jun 27, 2012 at 7:47
-
1This question has been answered numerous time in SO and there is a very good documentation in CI UserGuide to do so.. codeigniter.com/user_guide/general/urls.htmlBroncha– Broncha2012-06-27 09:34:34 +00:00Commented Jun 27, 2012 at 9:34
Add a comment
|
3 Answers
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
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
PrestonDocks
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