OK, I have two domains, let’s say
example1.com and
example2.com. Both are accessing the same webspace. Domain 1 used to be the default domain for years, now I want to make domain 2 the default and redirect domain 1 to domain 2. Additionally, I had a www-to-non-www redirection in place for domain1 and of course I want to keep this (for the new domain and the redirection from old to new).
I have the following rule in my htaccess file:
Code:
RewriteCond %{HTTP_HOST} !^example1.com$ [NC]
RewriteCond %{HTTP_HOST} !^example2.com$ [NC]
RewriteRule ^(.*)$ http://example2.com/$1 [L,R=301]
Now, this is correctly redirecting both,
http://www.example1.com and
http://www.example2.com to
http://example2.com but it’s
not redirecting
http://example1.com (without www) to domain 2.
How can I achieve what I want?