We want to open a new domain for certain purposes (call them PR). The thing is we want the domain to point to the same website we currently have.

We do not want this new domain to appear on search engines (specifically Google) at all.

Options we've ruled out:

  • Robots.txt can't be used - it will work the same on both domains, which isn't what we want.
  • The rel=canonical doesn't block - only suggests to index a similar page instead. The original page might end up being indexed.

Is there a way to handle this?

  • 1
    So are you saying the new domain will serve the exact same files from the same server but under a different domain?
    – joesk
    Feb 5, 2013 at 15:10
  • @joesk - precisely.
    – JNF
    Feb 6, 2013 at 7:19
  • stackoverflow.com/questions/14709747/…
    – unor
    Feb 6, 2013 at 18:26

2 Answers 2


If you simply want our site accessible at the new domain, and it is acceptable that the URL reverts to the old domain upon navigating to the site, then your need will be satisfied by using 301 redirects to map the new domain to your existing site.

Otherwise, you can serve a special robots.txt file only for your new domain. To do that, place something like this in your htaccess file:

RewriteCond %{HTTP_HOST} ^yournewdomain\.com$
RewriteCond %{REQUEST_URI} ^/?robots.txt$
RewriteRule .* /robots-yournewdomain.txt [L]

rel=canonical is just a suggestion, but it is a strong suggestion. Google would certainly honor it in a situation like this. Other search engines might not do so very well. I use rel=canonical to keep development servers from being indexed even when they are publicly accessible. Googlebot will still crawl the entire site on my development server, but it won't actually index it.

For anything else to work, you will need to be able to have some difference in the code between the two sites. You could serve two different robots.txt files. You could use .htaccess and mod_rewrite to choose the correct file for the correct domain. Here is a blog entry that walks you through the mechanics of doing so: http://blog.cherouvim.com/robotstxt-control-for-host-aliases-via-mod_rewrite/

Alternately you could put a meta noindex tag on the pages of the new site. I don't know what software powers your site, but it could be possible to modify it so that you just noindex just the new site. For example, if you site is powered by PHP, you could put the meta noindex inside a statement like

if ($_SERVER['HTTP_HOST'] == 'new.example.com'){

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.