CodeIgniter Forums
Bah! Google index subdomain rather than the real domain! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Bah! Google index subdomain rather than the real domain! (/showthread.php?tid=2708)



Bah! Google index subdomain rather than the real domain! - El Forum - 08-20-2007

[eluser]CI Lee[/eluser]
Hello all...


I had been using pr1.domain.com to preview a site for the client. Now I use domain.com yet the google index still points to pr1.domain.com, when someone clicks that link it is valid because the subdomain (or any for that matter) points to domain.com.

Any suggestions on how to fix that? I have the webmaster tools and can do the url removal if I want however I dont want to lose those inbound links.

-Lee


Bah! Google index subdomain rather than the real domain! - El Forum - 08-20-2007

[eluser]garymardell[/eluser]
why not just setup pr1 again and redirect users back to domain.com

for google purposes there is .htaccess methods you can use for google bot etc.


Bah! Google index subdomain rather than the real domain! - El Forum - 08-20-2007

[eluser]CI Lee[/eluser]
Well you can visit pr1.domain.com or xyz123.domain.com and it will still show you the proper site....

The problem is that google thinks that the proper url is pr1.domain.com


Bah! Google index subdomain rather than the real domain! - El Forum - 08-20-2007

[eluser]CI Lee[/eluser]
So I have created a directory of pr1.domain.com and placed
Code:
RewriteEngine On
rewritecond %{http_host} ^pr1.domain.com
rewriteRule ^(.*) http://domain.com/$1 [R=301,L]

Within it as an .htaccess file.

My question is will google update the url in its directory based on that file?


Bah! Google index subdomain rather than the real domain! - El Forum - 08-20-2007

[eluser]Michael Wales[/eluser]
Use a permanent redirect (what is that, a 301, 302, whatever). Google will pick up on it as it spiders the site and correct the URLs.


Bah! Google index subdomain rather than the real domain! - El Forum - 08-20-2007

[eluser]BravoAlpha[/eluser]
301 = Moved Permanently

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Edit:
Quote:301 Moved Permanently
...
The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs.



Bah! Google index subdomain rather than the real domain! - El Forum - 08-21-2007

[eluser]alpar[/eluser]
i think a 302 would be a better solution, that way you will win some time and any ratings will be transfered, also you should add a robot.txt for your build environments to deny spider access.