Reputation: 1173
I have an test project in sub directory (G:/wamp/www/test) which has only index.php and .htaccess
I tried to make friendly urls by adding RewriteRule to .htaccess like this:
RewriteEngine on
DirectoryIndex index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^/*$ index.php
This worked on all other projects but it is not working on this one. When I want to access an URL like this:
http://localhost/test/TESTING_URL
I am getting default 404 Not Found page. However, if I go like this: http://localhost/test/index.php/TESTING_URL
- it works.
Apache error log is giving me the following error:
File does not exist: G:/wamp/www/test/TESTING_URL
Upvotes: 0
Views: 1529
Reputation: 8325
The following worked for me:
RewriteEngine on
RewriteBase /test/
DirectoryIndex index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^/*$ index.php
Make sure that this .htaccess file is in the directory test
and that there aren't any conflicting rewrite rules in any .htaccess file at a higher level.
Otherwise the only difference is the addition of the RewriteBase line.
Upvotes: 1