[wp-hackers] 302 redirect - why?

Frank Helmschrott fhelmschrott at gmail.com
Fri Feb 13 13:33:28 GMT 2009


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


More information about the wp-hackers mailing list