How to remove index.php from the URL in CodeIgniter

  • Post author:
  • Post category:CodeIgniter
  • Post comments:4 Comments
  • Post last modified:February 2, 2021
  • Reading time:1 mins read

In this tutorial, you are going to learn a simple trick in CodeIgniter and that is how to remove index.php from the URL of your Codeigniter project. If you are a beginner then check out all the CodeIgniter related blogs on this website.

Now, create a  dot(.) htaccess file in your project folder root directory as shown in the picture below:

remove index.php from the URL

After that copy, the code is given below and paste in the file .

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php/$1 [L] 
 </IfModule>
remove index.php from the URL

Now go to config.php folder (PATH: myci\application\config\config.php) then change your code from $config[‘index_page’] = ‘index.php’; to $config[‘index_page’] = ”;  Means leave it blank.

remove index.php from the URL

remove index.php from the URL in CodeIgniter are done. Please leave your suggestion on the comment box. to support us follow our social media links. Subscribe our youtube channel BeAppend. Follow on Instagram like your Facebook page.

This Post Has 4 Comments

  1. Thank you for the auspicious writeup. It in fact was a amusement account it.
    Look advanced to far added agreeable from you!
    However, how can we communicate?

  2. Hi would you mind letting me know which hosting company you’re utilizing?
    I’ve loaded your blog in 3 completely different browsers and I must
    say this blog loads a lot faster then most.
    Can you recommend a good hosting provider at a fair
    price? Thanks, I appreciate it!

Leave a Reply