Mobile app version of vmapp.org
Login or Join
Smith883

: Why Google indexed the preview URL of domain? 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

@Smith883

Posted in: #GoogleIndex #Htaccess #Url #WebHosting

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 ^(.*)$ www.charchas.gr/ [r=301,nc,L]


Here is a preview of Cpanel

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Smith883

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme