How to remove index.php from the URL in CodeIgniter

  • Post author:
  • Post category:CodeIgniter
  • Post comments:7 Comments
  • Post last modified:October 5, 2020
  • Reading time:1 min(s) 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 7 Comments

  1. หวย

    Hey! This is kind of off topic but I need some help from an established blog.
    Is it hard to set up your own blog? I’m not very techincal but
    I can figure things out pretty fast. I’m thinking about making
    my own but I’m not sure where to begin. Do you have any ideas or
    suggestions? With thanks

  2. 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?

  3. 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!

  4. Lenora

    My brother recommended I would possibly like this web site.

    He was once entirely right. This publish actually made my day.
    You cann’t imagine just how so much time I had spent for this information! Thank you!

Leave a Reply