homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Google / Google News Archive
Forum Library, Charter, Moderator: open

Google News Archive Forum

Avoiding a Site Showing Twice in Google
ns.example.com/~preview and www.example.com

 6:39 am on Jan 28, 2004 (gmt 0)

I recently redesigned and moved a client's site from his hosting account to one of my servers.

Google is now showing the site as listed as www.example.com and ns.example.com/~adminxx/ (ensim domain preview).

Is there any way I can get the preview domain removed?

I cannot use meta tags (noindex etc) or robots.txt (disallow), as that would impact on the domain as well.

I'd hate to get him hit with a dupe penalty.

[edited by: ciml at 8:22 am (utc) on Jan. 28, 2004]
[edit reason] Examplified domains. [/edit]



 12:26 pm on Jan 28, 2004 (gmt 0)

I'd use "cloaking". Show "noindex" if the host is ns.yourdomain.com/~adminxx/ and "index" if the host is www.domain.com I guess this PHP/cgi/... hack shouldn't be too hard to implement.


 1:12 pm on Jan 28, 2004 (gmt 0)

Is there any way I can get the preview domain removed?

1) why not use robots.txt, disallowing googlebot for the subdirectory?
2) if you are finished with the preview then delete it, google will get 404's and drop the pages


 9:44 pm on Jan 28, 2004 (gmt 0)

if you are finished with the preview then delete it, google will get 404's and drop the pages

The problem is that whatever is at the preview domain, is also at the domain name.

I think the way ensim does it, is that the domain is like a pointer. Adding a robots.txt to the preview site will also show up on the domain site.

Maybe cloaking is the way to go. I know how to get the current page etc. but finding out whether the visitor is on the preview domain or the actual domain may take some work.

Thanks guys.


 9:52 pm on Jan 28, 2004 (gmt 0)

This is an easy one... Add this code to your .htaccess file in your ROOT directory:

RewriteEngine On
RewriteCond %{HTTP_HOST}!^www\.domain\.com
RewriteRule ^.*$ [domain.com%{REQUEST_URI}...] [R=301,L]

If on linux, using Apache with Mod_Rewrite installed (which is almost always the case), this code will redirect the ns.domain.com/~preview to www.domain.com

Let me know if it works for you (I use it on all my sites, gotta love 301 in mod_rewrite).


 1:55 am on Jan 29, 2004 (gmt 0)

Unfortunately, modifying .htaccess to include the 301 redirect code conflicts with FrontPage extensions. You can either use FrontPage extensions or the redirect, but not both.

A PHP script was suggested as an alternative for FrontPage users by a member with an all-php website at:


as follows:

if ($_SERVER['HTTP_HOST']!= "www.yourdomain.com") { if ($_SERVER['SCRIPT_NAME']!= "/index.php") $url = "http://www.yourdomain.com" . $_SERVER['SCRIPT_NAME']; else $url = "http://www.yourdomain.com/"; header("HTTP/1.1 301 Moved Permanently"); header("Location: $url"); }

I have an htm website and never have used php. I tried variants in my header, inserting the php code between <?php and ?>, but could not get it to work. Any suggestions?

Also, would switching to Windows hosting solve the problem for FrontPage users?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Google / Google News Archive
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved