Quantcast

302 redirect - why?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

302 redirect - why?

Helmi-2
wrong list, sorry - this should have gone to wp-hackers instead of wp-testers.

---------- Forwarded message ----------

Hi,

in wp-trackback.php around line 80 the code looks like that:

if (empty($title) && empty($tb_url) && empty($blog_name)) {
       // If it doesn't look like a trackback at all...
       wp_redirect(get_permalink($tb_id));
       exit;
}

This redirects a request to the trackback URL that isn't a real
trackback. This redirect is HTTP Status 302 redirect. Why is that? Is
there any special reason for a 302? We're currently still researching
things but it looks like a bit that this can couse google to penalize
a wordpress blog. But that's not the real case here. By definition a
302 redirect means "Moved temporarily" which definitely isn't the case
here.

For non-trackback-requests the correct url is _always_ the one where
the user get's redirected so this is a permanent move - ergo 301. This
code change is all that has to be done:

if (empty($title) && empty($tb_url) && empty($blog_name)) {
       // If it doesn't look like a trackback at all...
       wp_redirect(get_permalink($tb_id),301);
       exit;
}


just add the ,301 to the end of wp_redirect function.

It would be good if this could be done in the codebase as there
shouldn't be a need for a 302 redirect.

Thanks!


--
Frank



--
Frank
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 302 redirect - why?

Otto-19
The reason you have it send a 302 instead of a 301 is that you don't
want the client to change the actual URL it's sending to, if it sent
the wrong thing by mistake.

Say a client tries to send a trackback, but something goes wrong and
it leaves off the URL. You send back a 301. According to standard
methods, the client, if it retries later, should retry at the new
location only. Meaning that the trackback will never get there.

By sending a 302, you account for possible errors.



On Fri, Feb 13, 2009 at 7:33 AM, Frank Helmschrott
<[hidden email]> wrote:

> wrong list, sorry - this should have gone to wp-hackers instead of wp-testers.
>
> ---------- Forwarded message ----------
>
> Hi,
>
> in wp-trackback.php around line 80 the code looks like that:
>
> if (empty($title) && empty($tb_url) && empty($blog_name)) {
>       // If it doesn't look like a trackback at all...
>       wp_redirect(get_permalink($tb_id));
>       exit;
> }
>
> This redirects a request to the trackback URL that isn't a real
> trackback. This redirect is HTTP Status 302 redirect. Why is that? Is
> there any special reason for a 302? We're currently still researching
> things but it looks like a bit that this can couse google to penalize
> a wordpress blog. But that's not the real case here. By definition a
> 302 redirect means "Moved temporarily" which definitely isn't the case
> here.
>
> For non-trackback-requests the correct url is _always_ the one where
> the user get's redirected so this is a permanent move - ergo 301. This
> code change is all that has to be done:
>
> if (empty($title) && empty($tb_url) && empty($blog_name)) {
>       // If it doesn't look like a trackback at all...
>       wp_redirect(get_permalink($tb_id),301);
>       exit;
> }
>
>
> just add the ,301 to the end of wp_redirect function.
>
> It would be good if this could be done in the codebase as there
> shouldn't be a need for a 302 redirect.
>
> Thanks!
>
>
> --
> Frank
>
>
>
> --
> Frank
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



--
-
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 302 redirect - why?

Eric Marden-2
In reply to this post by Helmi-2
> We're currently still researching
> things but it looks like a bit that this can couse google to penalize
> a wordpress blog.

302 is a temporary redirect.
301 is permanent.

If you move a resource to another URL you want to use 301s to tell  
clients, including google, where they can find the new resource and to  
update their links to use this new URL. Google won't penalize you for  
redirects, unless you are trying to something fishy like have a page  
indexed highly for one topic, but then redirect the page after its  
been indexed to another page with a different topic. In other words,  
302 redirects are not 'bad' and in this case are used because using  
any other response code would not semantically make sense.

-e
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...