Removing index.php in codeigniter xampp for windows - rakeshraushan/CodeIgniter-1 GitHub Wiki

Removing index.php in codeigniter xampp for Windows

STEP 1: Create .htaccess using command prompt To create .htaccess file in windows:

1.) Open Command Prompt. 2.) In the command line, go to the directory or folder where you placed your root folder or codeigniter folder.

Example in Command Prompt console: C:\xampp\htdocs\site_folder

3.) Type copy con .htaccess to create a .htaccess file in the folder

Example in Command Prompt console: C:\xampp\htdocs\site_folder copy con .htaccess

4.) Press [ENTER]. A blank line after the command line appears

Example in Command Prompt console: C:\xampp\htdocs\site_folder copy con .htaccess

5.) Type the following code:

RewriteEngine On # Put your installation directory here: # If your URL is www.example.com/, use / # If your URL is www.example.com/site_folder/, use /site_folder/

RewriteBase / # Do not enable rewriting for files or directories that exist RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

For reuests that are not actual files or directories,

Rewrite to index.php/URL

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

#------------------------------------------------------------------------------------------ NOTE: RewriteBase must be set to the folder or directory in which you place your CI folder

If your URL is www.example.com/ then use

RewriteBase /

If your URL is www.example.com/site_folder/ then use [b] RewriteBase /site_folder/ #------------------------------------------------------------------------------------------

6.) After typing the code above press:

^Z will appear on the cmd line

^Z

7.) Press [enter]. The .htaccess file is now saved in your site_folder not as a text file but as a .htaccess file.

STEP 2: Configure mod_rewrite in httpd.conf 1.) Locate your httpd.conf

Example: C:\xampp\apache\conf\httpd.conf[/quote]

2.) Search for the line

#LoadModule rewrite_module modules/mod_rewrite.so

3.) Uncomment the line, into:

LoadModule rewrite_module modules/mod_rewrite.so

4.) Save Changes.

STEP 3: Configure config in you site_folder (codeigniter) folder

1.) Locate your config.php

Example: C:\xampp\htdocs\site_folder\system\application\config

2.) Change

$config['index_page'] = "index.php";

to

$config['index_page'] = "";

⚠️ **GitHub.com Fallback** ⚠️