I have some problems when the web host updated the plesk desk and the server.

I looked to see which pages are indexed site:www.charchas.gr and then I looked for the preview site:charchas.gr.193-92-107-8.linuxzone28.grserver.gr (this URL is to look the website if it does not yet have an associated domain name). Seems to have indexing 25 pages. Τhe question is why and how can block for the search results?

I use in .htacess this code but nothing changed.

RewriteBase /
    RewriteCond %{http_host} !^www.charchas.gr$ [nc]
    RewriteRule ^(.*)$ http://www.charchas.gr/$1 [r=301,nc,L]

Here is a preview of Cpanelenter image description here


Why Google indexed the preview URL of domain?

Because Google found the URL; somehow! Emails, social media, etc. etc. I assume you are on a shared server(?) in which case there are probably others that are using a similar URL whilst developing their sites?

I use in .htacess this code but nothing changed.

Presumably your .htaccess (two c's) code does redirect the "preview" URL to the live domain? (You have RewriteEngine On I assume?) In which case it will just take time for Google to reindex your site at the correct URL (assuming that is your intention).

In the future...

To prevent your "preview" URL getting indexed you could perhaps password protect your site, or temporarily/conditionally set an X-Robots-Tag HTTP response header (one or two lines in .htaccess)?

To temporarily prevent your site from being indexed at all, you can add the following to .htaccess (remember to remove it when your site goes live!) in order to set an X-Robots-Tag HTTP response header (the equivalent of setting a robots meta tag on every resource).

Header set X-Robots-Tag "noindex,nofollow"

To conditionally set this header only when the "preview" URL is accessed you can try the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$
RewriteRule .* - [E=block:1]
Header set X-Robots-Tag "noindex,nofollow" env=block

Where example.com is your actual/live domain. In other words, only send this header when you access the site from a domain other than the live domain. This will allow your live site to be indexed, but block the "preview" URLs from being indexed. If you don't want your site to be indexed whilst you are developing it then you will need to use the unconditional version above.

The above directives set an environment variable (block) when accessing a domain other than example.com and only sets the X-Robots-Tag header when this environment variable is set.

  • Did you mean that in this IP193.92.107 used and other websites something like this example-1.com.193-92-107-8.linuxzone28.grserver.gr
    – Charchas
    Mar 17 '15 at 10:12
  • Yes. In fact doing a site search for site:193-92-107-8.linuxzone28.grserver.gr returns over 5,000 pages that appears to cover a handful of other domains.
    – MrWhite
    Mar 17 '15 at 10:22
  • yes I saw it and I hope that the .htacces file do the job
    – Charchas
    Mar 17 '15 at 10:25
  • Sorry, but i forgot to ask. How to use X-Robots-Tag in htaccess. I have not used it before and can not find something on the internet
    – Charchas
    Mar 18 '15 at 8:52
  • @Charchas I've updated my answer with some examples.
    – MrWhite
    Mar 18 '15 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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