I am using ISAPI-Rewrite on IIS7.
How can we combine [NC] and [OR] in a RewriteCond ? [NC,OR] ?
What is the simple way to match domains with and without “www.” ?
Here is a draft :
RewriteCond %{HTTP_HOST} ^old-one.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.old-one.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^old-two.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.old-two.com$ [NC]
RewriteRule ^(.*)$ http://www.new-website.com/$1 [QSA,L,R=301]
Yes,
[NC,OR]is the way of combining those two flags.To combine multiple similar conditions into one, try this one:
P.S.
Since you are on IIS 7, why not use their native rewriting engine (URL Rewrite module) — yes, it has different syntax (not .Apache’s .htaccess, but standard web.config XML file) but does work fine (no performance issues here on my servers).