-
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
[color=green][b]***STEP 1:[/b]Create .htaccess using command prompt[/color]
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] [color=blue]
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][/color] [/quote]
[color=red] NOTE: RewriteBase must be set to the folder or directory in which you place your CI folder [/color]
[quote] [color=purple]If your URL is www.example.com/ then use [b] RewriteBase / [/b] [/color] [color=purple] If your URL is www.example.com/site_folder/ then use [b] RewriteBase /site_folder/ [/b] [/color] [/quote]
6.) After typing the code above type [b] [color=blue] [ctrl]+Z [/color] [/b]
^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.
[color=green] [b] ***STEP 2: [/b] Configure mod_rewrite in httpd.conf [/color]
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.so4.) Save Changes.
[color=green] [b] ***STEP 3: [/b] Configure config in you site_folder (codeigniter) folder[/color]
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'] = "";