[wp-hackers] 302 redirect - why?

Otto otto at ottodestruct.com
Fri Feb 13 16:10:47 GMT 2009


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
<fhelmschrott at gmail.com> 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
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
-


More information about the wp-hackers mailing list