I am starting a music blog at www.domain1.com
. That URL is an alias shared with www.domain2.com
which is just a domain I happen to have hosting with but is unused. In the future I may want to develop a site at www.domain2.com
as a portfolio site but for now I have www.domain1.com
that I want to use with my hosting.
At first I had www.domain1.com
forwarding to www.domain2.com/domain1
and masking that URL so visitors would only ever see www.domain1.com
but the URL never changed when people navigated and not having unique URLs is bad for many reasons. I also tried that because it would allow me to be able to develop sites at both domain2.com
and /domain1
. However, the unique URL thing is an issue. So I ditched that idea and I created an alias. Great! Now I have unique URLs. However now the same content displays at both domain2.com
and www.domain1.com
. Not great.
My question is how do I tell Google that for the content that is at domain1.com
to index that site and don't credit www.domain2.com
so I avoid duplicate content issues?
Do I add this to the config file?
RewriteEngine on
RewriteRule ^(.*)$ domain1.com$1 [NC,L,R=301]
canonical-url
, which indicates you're aware of what that's for. That would certainly apply here, is there a reason you don't want to simply use that?301
redirect one domain to the other, which accomplishes the same. Is that what you're asking how to do?302
is just a temporary redirect for clients and search engines alike. You'll need to use a301
,noindex
, or canonical URLs to indicate to Google which is the preferred URL to index. You likely wouldn't get penalized if you don't, but you won't have any control over search engine results, so you'll need to use one of the above if that's important to you. There are a lot of questions here on how to apply them, just use the Search function above to find them.