Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by chazy (aldever calvo) )

Removing index.php in codeigniter xampp for windows

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:
Command Prompt

C:\xampp\htdocs\site_folder 

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

Example:
Command Prompt

C:\xampp\htdocs\site_folder copy con .htaccess 

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

Example:
Command Prompt

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
RewriteBase /site_folder/

6.) After typing the code above type
[ctrl]+Z

^Z will appear on the cmd line

   

^

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

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'""