Forum Moderators: phranque
I added the following line in my .htaccess file, but it did not work:
RedirectMatch 301 (.*)site2.com [site1.com...]
Is this because the first parameter has to be a file or subdirectory and can't be a domain? If so, how would I setup a conditional redirect based on the contents of the domain name?
# Enable mod_rewrite
Options +FollowSymLinks
RewriteEngine on
#
# Redirect site2.com, www.site2.com, and site1.com to www.site1.com
RewriteCond %{HTTP_HOST} ^(www\.)?site2\.com [OR]
RewriteCond %{HTTP_HOST} ^site1\.com
RewriteRule (.*) http://www.site1.com/$1 [R=301,L]