As you may or may not have noticed by now, the current version of WordPress has a little problem. Instead of using 301 headers during a redirect, the CMS is currently using 302 responses to all rewritten URLs. This means www or not www, adding trailling slashes, and even redirects from the default URL structure to whatever permalinks you’re using (site.tld/?p=1 -> site.tld/category/postname). To view the live HTTP headers on any site, just download this Firefox addon and use as needed.
Surfers probably won’t notice the difference. That’s the good news: users do get to the page they’re looking for. The problem, however, is that the search engine spiders are kind of being told to keep both URLs in the index. At Google’s webmaster tools, I confirmed that links were being counted seperately even though they pointed to the same URL after redirects.
So when did this change come about? I’m really not sure, but I was lucky enough to catch this post and eventually find a solution. Some sites have experienced the 302 for a while, but the last time I checked my own sites (maybe three to six months ago at the most) I had always seen 301s. Is there a plugin or theme issue involved? Possibly, was there a plugin that was preserving 301 redirects even after WP had switched to 302s? Was it a hosting issue? If so, it was the same issue on Bluehost and Dreamhost alike. None of the suspected causes delivered a convincing explanation.
Fix the 302
Ultimately, I decided the history of the problem was less important than a quick and immediate solution. Someone else can figure out what went wrong, and hopefully one of the newer versions of WordPress will go back to the SEO-preffered 301 redirect method.
First I spent a lot of time learning about WP’s redirect and rewrite functions, and a whole lot of hours digging through PHP in order to add a 301 specification everywhere I could. That didn’t actually change anything, but I didn’t break it either so we’ll call it a wash.
I tried a few plugins, but they left the permalink and trailing slash redirects as 302. A lot of the redirect plugins only manage unique cases with 301s. Not too helpful, could have done that in the .htaccess file.
Anyway, be sure to check out the Redirection plugin if you’ve got the WordPress 302 blues and need a quick fix. While the mod is kind of bulky and has a whole lot of options and functions I don’t necessarily need, it did immediately convert all permalink and WordPress managed redirects into 301 codes. The install is easy and the plugin is free, so be sure to take advantage of this addon if you’re still seeing 302 in your WordPress installation’s http header response!