Forum Moderators: coopster

Message Too Old, No Replies

PHP redirect without 302?

         

JohnKelly

11:58 pm on Mar 15, 2005 (gmt 0)

10+ Year Member



Is there a way to link to a site using a PHP redirect script (to preserve pagerank) but not generate a code 302?

Here's the script I'm using now:

<?php
header("Location: $url");
?>

This generates a 302 Redirect in the headers, which can cause problems with Google and MSN.

jdMorgan

12:27 am on Mar 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A 302 is the default response. If you don't want a 302, specify a 301:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: $url");
?>

Jim

HughMungus

1:38 am on Mar 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was wondering this week (after so much about 302's) if a meta-refresh would work, too. Is that a no-no for SEO now? Is that penalized?

JohnKelly

1:45 am on Mar 16, 2005 (gmt 0)

10+ Year Member



I want the links to open in a new window via the tracking script, so meta-refresh wouldn't work.

But wouldn't it be better to use a code 200 (OK) instead of 301? Otherwise it would seem to be making the problem worse with a 301 Permenantly Moved.

I'm trying not to contribute to the problem for other sites I link to with all the 302 issues being reported.

larryhatch

5:35 am on Mar 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not counting outgoing traffic personally, so I have
no need for php scripts etc.
All my outgoing links are of the straight href=URL type.
This avoids ALL the problems discussed, 302s, the works.
You can easily make the target page open in a new window,
all with a 200 response code. No problems at all. -Larry

Turbonutter

1:10 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



Bottom line, if you're redirecting people and a 302 or 301 is not appropriate, you're doing it wrong.

madmatt69

4:02 pm on Apr 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got a similar problem.

I'm using a click.php type script to handle my affiliate links, and I don't want them generating 302's. 301's seem inapropriate though (I'm probably wrong there though).

Is it possible to just pass the code 200 and have it work?