Forum Moderators: open
-http://www.mydomain.com
-http://www.mydomain2.com (alias)
Google seems to constantly switch between listing the first and second domain for an important keyword I keep track of, even though mydomain2.com is a legacy domain that I no longer have reference to on my site (though there still exists some links to it on other sites).
Is it a good idea to use .htaccess and simply redirect all visitors (not just Google) to mydomain.com when the legacy domain is typed in? Something like this:
RewriteEngine On
RewriteCond %{HTTP_HOST}!www.mydomain.com
RewriteRule ^.*$ [%{SERVER_NAME}%{REQUEST_URI}...] [R]
Might Google consider this as "fishy"? If there's a better .htaccess to use for domain redirection, I'd appreciate that info as well.
Thanks,
Is it a good idea to use .htaccess and simply redirect all visitors (not just Google) to mydomain.com when the legacy domain is typed in?
Yes.
One important modification to your code: in the RewriteRule, use [R=301] which produces a permanent redirect, not plain [R] which produces a temporary (302) redirect. This will cause Google to (eventually) credit the target page with any PR brought in by the original links.