How to remove “index.php” in PHP CodeIgniter’s path?

Spread the love

Sometimes, we want to remove "index.php" in PHP CodeIgniter’s path.

In this article, we’ll look at how to remove "index.php" in PHP CodeIgniter’s path.

How to remove "index.php" in PHP CodeIgniter’s path?

To remove "index.php" in PHP CodeIgniter’s path, we modify the .htaccess file to remove index.php.

For instance, we write

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

<Files "index.php">
AcceptPathInfo On
</Files> 

in .htaccess to redirect paths without index.php to index.php with

RewriteRule ^(.*)$ index.php/$1 [L]  

Conclusion

To remove "index.php" in PHP CodeIgniter’s path, we modify the .htaccess file to remove index.php.

Leave a Reply

Your email address will not be published.