I am doing a project in CodeIgniter 3. I need to remove index.php
from url. For that help me to get .htaccess
file for CodeIgniter 3 and also where
.htaccess
file at root
of the project.htaccess
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
Header set Access-Control-Allow-Origin: "*"
2. Remove index.php at the root/application/config/config.php
$config['index_page'] = '';
3. If your server is new | your server rewrite mode was denied than Open Terminal Connect Your Server Via SSH Type Below Code
sudo a2enmod rewrite
sudo service apache2 restart
sudo nano /etc/apache2/apache2.conf
After that please check AllowOverride
Is All
or not
AllowOverride All