Remove index.php from url in Codeigniter

Step:-1 Open the folder “application/config” and open the file “config.php“. find and replace the below code in config.php file.

//find the below code
$config['index_page'] = "index.php"
//replace with the below code
$config['index_page'] = "

Step:-2 Go to your CodeIgniter folder and create .htaccess in Your_website_folder/ then write the following code

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

Step:-3 In some case the default setting for uri_protocol does not work properly. To solve this problem just open the file “application/config/config.php“, then find and replace the below code

//find the below code
$config['uri_protocol'] = "AUTO"
//replace with the below code
$config['uri_protocol'] = "REQUEST_URI"

Step:-4 Thats all but in wamp server it does not work because rewrite_module by default disabled so we have need to enable it. for this do the following

    1. Left click WAMP icon
    2. Apache
    3. Apache Modules
    4. Left click rewrite_module
Advertisements
Categories: PHP & Joomla | Tags: , , , , , | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: