Reputation: 1781
i am trying to remove index.php
from url
in codeigniter
usign .htaccess
my .htaccess
code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
my application/config/config.php
setting:
$config['index_page'] = '';
now when i go at: http://localhost/myProject
it works.. and call the default home controller
when i go at: http://localhost/myproject/home
it says:
The requested URL /myproject/home/ was not found on this server.
but when i go at: http://localhost/myproject/index.php/home
it again works and call the default home controller
i am using centos 6.5
while the same setting works perfect on windows 8 localhost
please help, any suggestion or help would be a great help .. thanks in advance
Upvotes: 0
Views: 2723
Reputation: 1781
i have edited the /etc/httpd/conf/httpd.conf
to AllowOverride
all:
<Directory "/var/www/html">
AllowOverride All
</Directory>
and now it is working as aspected... :)
Upvotes: 2
Reputation: 551
Try with this code:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Upvotes: 1