Tutorial Details

How to remove index.php from the URL using .htaccess in Codeigniter
11 Dec

How to remove index.php from the URL using .htaccess in Codeigniter

Hi Guys,

In this tutorial will learn How to remove index.php from the URL using .htaccess in Codeigniter. I will tell you the code for the best way to eliminate record php from url in Codeigniter utilizing .htaccess.

The .htaccess record gives a control to eliminate the index.php name from the URL and we can make some changes to the .htaccess record on the off chance that you need. you can likewise divert your site HTTP to HTTPS utilizing .htaccess.

As we probably are aware, Codeigniter runs index.php, and with another course, it accompanies an index.php record in the URL. On Ubuntu, I experienced the same problem. at the point when I was working on my client project on localhost. I eliminated the index.php document from the URL utilizing the .htaccess record.

So, We have to simply write the below code on your .htaccess file on the codeigniter project. let's open and add the below code to it.

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Now you can update your .htaccess file and check it.

Now you can run your project.

I hope it can help you...

0 Comments

Leave a Comment