skip to Main Content

Plesk offers you a handy way to preview the site before you switch over the DNS, called Websites Preview.

This is what it does:

customer-site.tld will be available for preview as customer-site.tld.192-0-2-12.your-domain.tld. Here 192-0-2-12 is the site’s IP where dots are replaced with dashes

I find this feature very useful, as we use it for proofing websites before they go live, however after the site goes live the customer-site.tld.192-0-2-12.your-domain.tld URL still exists, and is showing up in some Google results!

How can I remove the preview URL for certain sites only, not for all sites on the server?

Alternatively I think I may be able to use a .htaccess rule for this, but I cannot figure out how to do that without a redirect loop.

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer to this with some more searching (I searched for how to redirect domain alias, as that's what this essentially is).

    The answer is here: Redirecting all domain aliases to one with htaccess

    RewriteEngine On
    # If the hostname is NOT www.domain.com
    RewriteCond %{HTTP_HOST} !^www.domain.com$
    # 301 redirect to the same resource on www.domain.com
    RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
    

  2. Use robots.txt file to prevent crawlers from indexing your page. After you have done DNS switching, remove robots.txt file

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search