ItSolutionStuff.com

Codeigniter Remove index.php form URL using htaccess

By Hardik Savani • May 14, 2024
.htaccess Codeigniter

Hi Developer,

I want to share this tutorial for codeigniter remove index.php from url using htaccess file. i will show you code for how to remove index php from url in codeigniter using htaccess.

htaccess file provide a control to remove index.php name from url and also we can some validation on htaccess file if you want. you can also redirect your site http to https using htaccess.

As we know, codeigniter run index.php and with another route, it's come with index.php file in url. I had same issue on my ubuntu. when i was working on my client project on localhost. i did remove index.php file from url using htaccess file.

So, here you have to simply write below code on your .htaccess file on codeigniter project. let's open and add below code on 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...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Codeigniter Google Recaptcha Form Validation Example

Read Now →

Codeigniter JQuery Ajax Image Upload Example

Read Now →

Codeigniter Ajax Infinite Scroll Pagination Example

Read Now →

Codeigniter Image Upload with Validation Example

Read Now →

Codeigniter Generate PDF from View using Dompdf Example

Read Now →

Codeigniter Ajax CRUD Tutorial Example

Read Now →

Codeigniter Select2 Ajax Autocomplete from Database Example

Read Now →

How to Get Current URL in Codeigniter?

Read Now →