Forum Moderators: phranque
i've set up the rewritelog to check a new site.
my rewrite rule is a simple one:
RewriteCond %{REQUEST_URI}!(/adminŠ/php)
RewriteRule ^(([a-z0-9/]+)\.htm(l)?$ html.php?page=/$1 [L]
in my rewritelog i can see that apache compares every file on the page with these rules (all the css files, all the gifs, all the jpgs, etc)
i just wondered if this is normal rewrite behaviour?
thanks
RewriteCond %{REQUEST_URI} !^/(adminŠphp)/
RewriteRule ^(.+)\.html?$ html.php?page=$1 [L]
RewriteCond %{REQUEST_URI} \.html?$
Due to the order in which mod_rewrite processes directives, RewriteConds are only processed only if the RewriteRule pattern matches.
Therefore, it is best to make the RewriteRule pattern as specific but as simple as possible, while keeping RewriteConds to a minimum as well.
For this reason, it is best to avoid the use of many RewriteConds with RewriteRule patterns of ".*" whenever possible. Also, put the RewriteConds in order of most specific to least specific where this can be reasonably determined.
See the Apache mod_rewrite documentation [httpd.apache.org] section entitled API phases [httpd.apache.org] for a description of RewriteRule and RewriteCond processing order.
Jim
using
RewriteRule ^(.+)\.html? html.php?page=$1
doesn't catch the full domain name
[mydomain.com...] (without the index.html) returns a 403 forbidden?
RewriteRule ^$ html.php?page=$1
works, but isn't that a bit 'hackish'?