: Using an alias on my domain. How do I tell Google that I want it to only index the alias to avoid duplicate content? I am starting a music blog at www.domain1.com. That URL is an alias
I am starting a music blog at domain1.com. That URL is an alias shared with 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 domain2.com as a portfolio site but for now I have domain1.com that I want to use with my hosting.
At first I had domain1.com forwarding to domain2.com/domain1 and masking that URL so visitors would only ever see 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 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 domain2.com so I avoid duplicate content issues?
Do I add this to the config file?
RewriteEngine on
RewriteRule ^(.*)$ domain1.com [NC,L,R=301]
More posts by @Connie744
2 Comments
Sorted by latest first Latest Oldest Best
In the future I may want to develop a site at domain2.com
This is the concern with regards to a 301 redirect. A 301 redirect is considered permanent. Browsers and everything in between will cache the 301, so that if you did want to develop a site on domain2 later it could be problematic.
There's no point have the site accessible on both domain1 and domain2.
If you just want to forget about domain2 for the time being (strictly the main domain on the account) then you could conditionally serve a 403 Forbidden when accessing via domain2.com.
For example, using mod_rewrite in .htaccess in the document root:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain2.com [NC]
RewriteRule ^ - [F]
By using the F flag, a 403 Forbidden will be served when accessing via domain2.com.
To instead serve a 404 Not Found, you could change the RewriteRule to read:
RewriteRule ^ - [R=404,L]
the only fully seo compliant way is to let google index domain2 and get rid of domain1 out of the schema.
canonical is just a recommendation, to 301 the whole domain isn't a good way too. sure both ways work. but if talking bout seo - they aren't optimal solutions
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.