How would I redirect two domains using .htaccess

Posted by user302943 on Stack Overflow See other posts from Stack Overflow or by user302943
Published on 2010-03-26T23:45:00Z Indexed on 2010/03/26 23:53 UTC
Read the original article Hit count: 134

I'm trying to redirect one domain to the root and another to a directory. The problem I'm having is the second domain is overwriting the firsts redirection.

Here is what I have.

RewriteEngine On
RewriteCond %{HTTP_HOST}  !^http://example.site.net$ [NC]
RewriteCond %{REQUEST_URI} !^/.*$
RewriteRule ^(.*)$  / [L]

RewriteEngine On
RewriteCond %{HTTP_HOST} !^http://example2.com [NC]
RewriteCond %{HTTP_HOST} !^http://www.example2.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{REQUEST_URI} !^/example2_directory/
RewriteRule ^(.*)$ /example2_directory/$1   

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about mod-rewrite