How to remove index.php from codeigniter in UBUNTU?

This tutorial will show you that how to remove index.php from codeigniter in UBUNTU or how to enable url rewriting.

Step 1 :

Add this in htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine On
  #RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]

Step 2 :

Remove index.php in codeigniter config

$config['index_page'] = '';

Step 3 :

Allow overriding htaccess in Apache Configuration (Command)

sudo nano /etc/apache2/apache2.conf

and edit the file & change to

AllowOverride All

for www folder

Step 4 :

Enabled apache mod rewrite (Command)

sudo a2enmod rewrite

Step 5 :

Restart Apache (Command)

sudo /etc/init.d/apache2 restart


About admin

Check Also

Best resources to learn Laravel


  1. Thanks a lot! It worked!

  2. thanks much working fine

Leave a Reply

Your email address will not be published. Required fields are marked *