Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok guys I need to add an exception! How can I do this? I currently use RewriteRule ([^.]+).html $1 [R=301,L] to rewrite all .html urls

I do need the exception for the google.html verification file. How can I set this exception?

I tried this but it doesnt work. Any ideas?
RewriteCond $1 !^(google022e525bdb654772.html|googleb5e92d18c6640aeb.html)\/?

and I tried

RewriteCond $1 !^(google022e525bdb654772.html|googleb5e92d18c6640aeb.html)

share|improve this question

What you have isn't working because backreferences (like $1) in a RewriteCond refer to groups in the last matched RewriteCond rather than the RewriteRule.

Try the following instead:

RewriteCond %{REQUEST_URI} !^/google(022e525bdb654772|b5e92d18c6640aeb)\.html
RewriteRule ([^.]+).html $1 [R=301,L]
share|improve this answer

Rewrites are processed in order. Put in a rewrite which makes no changes, but declares itself the last rewrite, before your normal rewrites.

It's generally bad to litter rewrites with information of what they're not about, which has to be read past, when you can get the exceptions dealt with and out of the way instead.

RewriteRule ^/google022e525bdb654772.html$  -  [L]
RewriteRule ^/googleb5e92d18c6640aeb.html$  -  [L]
RewriteRule ([^.]+).html $1 [R=301,L]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.