I\'ve looked in the documentation of Codeigniter of removing the index.php
from the URL when accessing different views, the code shows how to remove it with apa
I have the same problem, the things is.
Try...
RewriteEngine on
RewriteBase /code/
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ code/index.php/$1 [L]
You all uri parts are rewrited, so it points to /index.php/code/home. The and good way to do it is to setup mapping eg. http://code.local to point to your /Users/~myusername~/Sites/code, then all your requests are resolved on the root level and everything will work as it should.
EDIT: Downvoters seem to be ignorants, but nevermind..
Here's what your code does now:
GET http://localhost/code/home
// rewritten to:
http://localhost/index.php/code/home
So like I said before the GOOD way would be host mapping so you get everything on the root level (which is GOOD as most likely you will have it this way on the production serv...) and that will do the trick withour changes in .htaccess.
Otherwise you may use Francesco's advice with RewriteBase, but a bit changed:
// Francesco's RewriteRule does this:
http://localhost/code/home
// rewritten to"
http://localhost/code/index.php/code/home
so simply change the RewriteRule to this:
RewriteRule ^code/(.*)$ index.php?/$1 [L]
// rewrites in your case to:
http://localhost/code/index.php/home
// which is what you wanted, aye?
You should change
RewriteRule ^(.*)$ /index.php/$1 [L]
to
RewriteRule ^(.*)$ /code/index.php/$1 [L]
You also need to modify the $config['index_page'] variable like this:
$config['index_page'] = '';
Please refer to my post at http://www.boxoft.net/2011/07/removing-index-php-from-codeigniter-2-0-2-url/ if you like.
Try this one
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
I tried 3 before I got one to work
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Create an .htacess file on the root folder of your web directory in codeigniter using the above code. You will be able to remove index.php if an url link contains index.php so it will display page with no error. Or if url doesn't contains index.php it will display the page without index.php in url.