Welcome to WebmasterWorld Guest from 3.226.251.81

Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Do PHP Header Forwards Hurt SE Ranking?

using header("Location: www.mysite.com/newpage.html");

     
2:56 pm on Jun 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


I was curious about using PHP Header Forwards and if they hurt your ranking in Google. I'm not sure how SE view forwards like this and I do use these on my site.

An example I have is if someone clicks a link of where they can buy our product it goes to a page www.example.com/forward.php?url=http://another.example.com

On this page it just contains a PHP Header Forward, header("Location: [another.example.com");....]

So to the user they think they are just going straight to the new website, whereas they are actually going to a page on my website that records they clicked that link and then it forwards to the new site.

Reason I ask this is because I noticed Google indexed the pages with the forwards (ex. www.example.com/forward.php?url=http://another.example.com)

Could this effect my rankings with Google? How does Google look upon sites that use this forwarding method?

Thanks in advance for your help!

Wes

[edited by: msgraph at 9:09 pm (utc) on June 6, 2005]
[edit reason] example'ized [/edit]

3:08 pm on June 6, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9074
votes: 6


The content location header issues a 302 redirect by default - making it problematic due to the "pagejacking" bug. You can easily fix this, however, by explicitly issuing a 301 Moved Permanently:

header("HTTP/1.1 301 Moved Permanently");
header("Location: http ://www.example.com/");

Personally, I prefer the approach which provides a direct link (no redirect) but overridden by a Javascript onclick event - because it gives more accurate click-thru rates as human visitors almost always have Javascript enabled and bots don't (so you're not counting the bots).

3:21 pm on June 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


Thanks for the reply encyclo.

That does sound like a good idea. Is it possible you have that javascript that you can send it to me?

Thanks again!

Wes

3:30 pm on June 6, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9074
votes: 6


You can use your existing PHP script (with the added header), then just do this:

<a href="http:// www.example.com/" [b]onclick="window.location.href='/forward.php?url=http://www.example.com/';return false;"[/b]>Your link text</a>

As the bots could pick up the onclick event as another URL to parse, you should exclude the click-track script (forward.php) in robots.txt. Replace

window.location.href
with
window.open
if you want the link to open in a new window.
3:51 pm on June 6, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


OK Great Thanks,

I will try that out.