how to configure codeigniter mod_rewrite on wamp?
There are total 4 easy steps that you need to follow (I am considering you have WAMP installed on C:\wamp
and CodeIgniter has been to extracted to C:\wamp\www\codeigniter\
):
- Create a .htaccess file as mentioned in http://codeigniter.com/wiki/mod_rewrite but replace
RewriteBase /
withRewriteBase /codeigniter/
according to your path. - Place this file in
C:\wamp\www\codeigniter\
folder - Open the httpd.conf file either from
WAMP->Apache->httpd.conf
or manually fromC:\wamp\bin\Apache\conf\httpd.conf
then locate the line#LoadModule rewrite_module modules/mod_rewrite.so
and replace the hash(#) from the beginning so that the complete line becomesLoadModule rewrite_module modules/mod_rewrite.so
. Now Restart Apache. - Finally open the file
C:\wamp\www\codeigniter\application\config\config.php
and replace$config['index_page'] = "index.php";
with this$config['index_page'] = "";
Your URLs should now be clean example http://localhost/codeigniter/blog
etc.
In case it didn't work, refer to the official wiki: http://codeigniter.com/wiki/mod_rewrite
Follow the steps above (ans 1) to get mod_rewrite enabled.
To check if enabled, use the WAMPManager menu like so:wampmanager -> Apache -> Module (Scroll the list and make sure is ticked)
create/edit .htaccess on your root CI folder where index.php located.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]</IfModule>
Edit config.php to
$config['index_page'] = '';
create/edit .htaccess on your root CI folder (where index.php is located)
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^system.* RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] RewriteRule ^(.*)$ /index.php?/$1 [L]</IfModule>