How to remove index.php from CodeIgniter URL in Ubuntu
CodeIgniter |
application/config/config.php
change:
$config['index_page']='index.php';
to$config['index_page']='';
Create or modify .htaccess in project root with following content.
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Also allow overriding .htaccess in your apache
/etc/apache2/sites-available/default
and edit the file & change toAllowOverrideAll
and Restart Apache
sudo /etc/init.d/apache2 reload
or
sudo service apache2 reload
or
sudo /etc/init.d/httpd reload
0 comments: