4

We have a domain with URL, lets say: http://www.xxxxstaging.com/abc.php?id=10 which is having a pretty good ranking for some keywords in google.

However, this is our staging website and due to some historical reason, it was exposed to public.

Now we have a production domain (the one we want to be publicly available), say: http://www.xxxxproduction.com/abc.php?id=10 which have exactly the same html output as xxxxstaging.com

Our question is, for the exactly same keyword search, it never appear in any page of google.

Is it possible for us to "switch" the ranking in google, either tell the robot that they are indeed the same website, or tell google to change it for us?

1
  • Not an answer to your immediate question but, in the future, consider using hosts file entries (like 1.2.3.4 domain.staging) and/or authentication on your staging instance to ensure that staging content never gets indexed.
    – danlefree
    Mar 14, 2011 at 21:08

1 Answer 1

4

Use a 301 redirect:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?xxxstaging\.com$ [NC]
RewriteRule ^(.*)$ http://www.xxxlive.com/$1 [R=301,L]

This will redirect users and the search engines to the new site and the proper pages as well. Search engines will also then associate the old URLs with the new URLs and eventually replace them in the search results.

3
  • 3
    +1 - ... but do that after you verify both domains at Google Webmaster Tools and initiate a Change of Address: google.com/support/webmasters/bin/answer.py?answer=83106
    – danlefree
    Mar 14, 2011 at 18:43
  • 2
    ... and use a different domain for your staging environment, and add a robots.txt to your staging to prevent google from indexing it. Mar 14, 2011 at 18:44
  • Both pieces of advice are spot on
    – John Conde
    Mar 14, 2011 at 18:46

Your Answer

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