It is possible to remove index.php
from the web browser address bar when CodeIgniter is running. This can be done by following these steps:
Create or open a
.htaccess
file. If a.htaccess
file does not already exist, you can create one using the following:Linux/Mac: Open a terminal window and type the following:
touch /path/to/CodeIgniter/.htaccess
Windows: Create a text file in your CodeIgniter root, naming it
file.htaccess
. Hold down the Windows key and then press R to open the Run dialogue. Enter the following command and click on OK:ren "C:\path\to\CodeIgniter\file.htaccess" .htaccess
Once your
.htaccess
file is opened, write the following lines at the top of the file:<IfModule mod_rewrite.c> RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>