Welcome to WebmasterWorld Guest from 54.145.208.64

Forum Moderators: open

Message Too Old, No Replies

Avoiding a Site Showing Twice in Google

ns.example.com/~preview and www.example.com

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

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

10+ Year Member



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)

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

10+ Year Member



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:

[webmasterworld.com...]

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?