I have been using simple mod_rewrite rules for my CMS for years and am now making a new version, I am seeing the rewriteCond not making sense- I have the standard \"if is no
Well, that should work.
Try setting the following props in your .htaccess:
RewriteLog /var/log/rewrite.log
RewriteLogLevel 3
To debug your requests. Remember to reset this value once you're done, otherwise you'll end up with a filled up harddrive.
Perhaps using RewriteLog
and RewriteLogLevel
to debug what it's doing?
(From http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html)
The RewriteCondition
s only apply to the next rule. You want this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?page=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ index.php?page=$1&var=$2
If you are using Apache 2.2, then you MUST read this:
http://amandine.aupetit.info/135/apache2-mod_rewrite/
Spoiler: what you will need to write is actually:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l
Merc.