How to remove index.php from the URL in CodeIgniter

  • Post author:
  • Post category:CodeIgniter
  • Post comments:9 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] 
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 9 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!


    Hi there, You have done a great job. I’ll certainly digg it and personally recommend to my friends.

    I am sure they’ll be benefited from this website.

  6. หวย

    I think everything composed was very reasonable. But, what
    about this? what if you were to create a killer headline?
    I am not suggesting your information isn’t solid., however
    what if you added a post title that grabbed folk’s attention? I mean How To Remove Index.php From The
    URL In CodeIgniter » BeAppend is a little boring.
    You ought to look at Yahoo’s front page and note how
    they create news headlines to get viewers interested. You might try adding a video or a picture or two to get readers interested
    about what you’ve written. Just my opinion, it could bring
    your blog a little livelier.

Leave a Reply