Reputation: 724
I use CodeIgniter on WAMP.
The Mod_Rewrite Module of Apache is loaded.
My CI project resides at C:\wamp\www\store
I have copied the rewrite rule from Codeigniter URL documentation (here):
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
The link I am trying to open is localhost/store/city
It seems to me that the rule never fires. When I try to open the above address, I receive the default 404 of my browser (not CI) and no rewriting seems to have occurred.
If I load localhost/store/index.php/city
the correct page loads.
Why would my rule not fire?
Upvotes: 0
Views: 2834
Reputation: 724
I placed this rule in the file:
RewriteRule (.*) http://test.com
As it turned out the the rewrite rules were not firing at all. The .HTaccess file needed to be moved. CI placed it in the Application folder. I dragged it out the parent folder, now all works well. Strange thing.
Upvotes: 0
Reputation: 1305
In application/config/config.php you have to set the index page to blank like:
$config['index_page'] = '';
Upvotes: 0
Reputation: 91
Use this code in your .htaccess file:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
this will help you for sure :)
Upvotes: 0
Reputation: 1273
try change
RewriteRule ^(.*)$ /index.php/$1 [L]
to
RewriteRule ^(.*)$ ./index.php/$1 [L]
Your method was trying to load the URL from the base
localhost/index.php/city
Upvotes: 3