Htaccess .html rewrite exception

.htaccessapache-2.2mod-rewriterewritecond

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)

Best Answer

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]
Related Topic