Browse By

How to remove index.php from URL in CodeIgniter framework on Windows Xampp

These below steps will help you to remove index.php in CodeIgniter framework using .htaccess.

Step:-1

Open the file config.php located in application/config path. Find and replace the below code.
// Find the below code
$config['index_page'] = "index.php"
// Remove index.php
$config['index_page'] = ""

Step:-2

Go to your CodeIgniter folder and create a .htaccess file.

Path: Your_website_folder/application/assets/system/user_guide/.htaccess

Step:-3

Add the below code in .htaccess file. Before this make sure you have mod_rewrite is enabled.

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

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:

// Find this line
$config['uri_protocol'] = "AUTO"
// Change it to
$config['uri_protocol'] = "REQUEST_URI"

Now your setup is complete. Access this url “http://localhost/ci/welcome” for a test run. You should be able to access this without index.php in url.

Latest Posts