How to remove index.php in CodeIgniter using .htaccess file

Dear Reader in This Tutorial let us We Know that “How we can Remove index.php from URL in Codeigniter Using .htaccess file”, So in this Tutorial, We Learn Step By Step Remove index.php Process As you can see the URL in the following snapshot.


In Codeigniter .htaccess file is the shorthand used for Hypertext Access, Which is a powerful configuration file that controls the directory “.htaccess”.

In many times we want to generate a specific URL on the basis of our requirements, then we use this technique which is very useful in Search Engine Optimization.

As we know that for SEO URLs are designed to be search engine friendly, So we need to Remove index.php from URL in Codeigniter.

There are few steps to Remove index.php from URL using .htaccess file:-

Step.1  At first, Open the file config.php which is located in application/config path.  Find and Replace the below code in a config.php  file


Step.2 Now Go to your CodeIgniter project folder and create a .htaccess  file in your project’s Root Directory


Step.3  Write the below code in your .htaccess file

Step.4  In some cases the default setting for uri_protocol does not work properly. To solve this issue just open the file config.php located in application/config and then find and replace the code as:


Congratulations you have successfully Removed index.php from URL in Codeigniter and your URL look like clean as this and don’t need to mention index.php before the file name.


I hope this post was helpful for you if this post was helpful for you then please share this post on Social Media and if you have any query then please Contact Us or Comment Bellow, Thanks



  • Terrence March 28, 2018

    Great work! This is the kind of info that are supposed to be shared around the web.

    Disgrace on the search engines for not positioning this put up
    higher! Come on over and talk over with my website .
    Thanks =)


    • Webpreparations Team March 29, 2018

      Thanks , you can communicate with us, we are always ready to server all


  • admin March 09, 2019

    Nice Article TheAndroidTrick>com


    • Webpreparations Team March 10, 2019

      Thank you dear reader for your appreciation.


Leave a comment:

Your email address will not be published. Required fields are marked *