Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect question

Status
Not open for further replies.

IDTstudios1

Programmer
Aug 8, 2004
72
US
Ok, this might be a little hard to grasp unless you are a php programmer or similar.

I have a domain called somebiz.com and somebiz.org they reside on the same virtual hosting account and have a script that sits in the root that redirects to subdomains based on the domain used to arrive at the site. In other words:

If person A types in somebiz.com the script will send them to
If person B types in somebiz.org they will be taken to
Now, my problem is that google keeps indexing the root with only the redirect script in it. How can I make google realize that it has been redirected?

Thanks
 
depends on how the redirect is being done.

using header("Location: new_url") will send a 302 response which is a temporary redirect and Google currently are having problems with 302 redirects. you will need to send a 301 response

I assume you are using $_SERVER('HTTP_HOST') to get the requested URL

the redirect code you should use is
Code:
header("HTTP/1.1 301 Moved Permanently");
header("Location: [URL unfurl="true"]http://www.newdomain.com/newdir/");[/URL]
exit();



Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top