-
Notifications
You must be signed in to change notification settings - Fork 26
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 [quote] Example: [b]Command Prompt
C:\xampp\htdocs\site_folder
[/b] [/quote]
3.) Type copy con .htaccess to create a .htaccess file in the folder
[quote] Example: [b]Command Prompt
C:\xampp\htdocs\site_folder copy con .htaccess
[/b] [/quote]
4.) Press [enter]. A blank line after the command line appears
[quote] Example: [b]Command Prompt
C:\xampp\htdocs\site_folder copy con .htaccess
|
[/b] [/quote]
5.) Type the following code
[quote]
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]
[/quote]
NOTE: RewriteBase must be set to the folder or directory in which you place your CI folder
[quote] If your URL is www.example.com/ then use [b] RewriteBase / [/b]
If your URL is www.example.com/site_folder/ then use [b] RewriteBase /site_folder/ [/b]
[/quote]
6.) After typing the code above type ** [ctrl]+Z **
^Z will appear on the cmd line
[b] ```php
^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
[quote]
Example:
C:\xampp\apache\conf\httpd.conf[/quote]
2.) Search for the line
```php
#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
[quote] Example: C:\xampp\htdocs\site_folder\system\application\config [/quote]
2.) Change
$config['index_page'] = "index.php";
to
$config['index_page'] = "";