How to to Remove index.php From Codeigniter in Ubuntu

less than 1 minute read

  • Install code igniter
  • Enable mode rewrie
$sudo a2enmod rewrite
  • Add the .htaccess files with contents
RewriteBase /your_project_name/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|install|css|robots\.txt)
RewriteRule .* index.php/$0 [PT,L]
Options -Indexes
  • Open the file and replace AllowOverride None by AllowOverride All
sudo gedit /etc/apache2/sites-available/default
  • Restart apache server
$sudo /etc/init.d/apache2 restart