Concatenating RewriteCond

Apache HTTPDIf you want to concatenate RewriteCond with logical AND it is enough to put them one under the other view:

Convert url to lower case using Apache HTTP

If you want to concatenate them with a logical OR then we must use the [OR] operator. For example, if we have the domains:

-flossblog.ca
-flossblog.co.uk
-flossblog.com
-flossblog.es
-flossblog.de

and we want to redirect the domains flossblog.ca and we would flossblog.co.uk to flossblog.com in the following way:

RewriteCond % {%{HTTP_HOST} flossblog.ca$ [OR]
RewriteCond % {%{HTTP_HOST} flossblog.co.uk$
RewriteRule ^ /(.*) $ http://www.flossblog.com/$ 1 [L,NE,NC]

Recommended reading

Mod_rewrite module

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.