Removing index.php from website url - Codeigniter

Removing the "index.php" filename from the URL makes the website nice and also search engines like it. It is easy to remove the index.php from the URL in CodeIgniter website.

Removing the "index.php" filename from the URL makes the website nice and also search engines like it. It is easy to remove the index.php from the URL in CodeIgniter website. Here are the three little steps.

  1. Enable the apache ModRewrite module. If you are using wamp server you do it by using the menu in the task bar icon. Most of the hosting providers enable this by default or this can be enabled in the cpanel of the hosting account.
  2. Open config.php from system/application/config directory and replace $config['index_page'] = “index.php” by $config['index_page'] =''
  3. Now create the .htaccess file in your web root and add the following lines in it.
    
    RewriteEngine on
    RewriteCond $1 !^(index.php|resources|robots.txt) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    
    
    If the Codeigniter website is installed in some folder but not in root directly then you have to set the base folder to that. For doing it copy paste the following after the first line in step 3. Replace test with the actual folder name.
    
    RewriteBase /test/
    
    

Website in minutes

Do you know that you can generate a complete PHP websites in minutes with PHP Website Generator?

Features

  • Free admin dashboard
  • Role based security
  • Login with Facebook, Google and more
  • Queue based email processing
  • Price at $3 for website
  • Uses CodeIgniter framework

Generate website now See Pricing



Connect with Google or Facebook and generate your next CodeIgniter website in minutes with plenty of features like searching with pagination, AJAX based grid data editors, group based security and admin portal etc.