Petestack Blog

10 January 2015

Permalinks and borked settings

Filed under: Site — admin @ 4:12 pm

Last month (with many blog posts being filed under multiple categories and WordPress seemingly no longer respecting my chosen ‘main’ category for the post URL) I decided to take the category name out of my custom ‘permalink’ structure to change it from ‘http://www.petestack.com/blog/category/postname.html’ to ‘http://www.petestack.com/blog/postname.html’. Which would have been fine if that’s what I’d actually done, but I stupidly just selected the similar standard WordPress ‘post name’ structure assuming that’s what it did and landed myself with ‘http://www.petestack.com/blog/postname/’ (see the difference?) instead… which worked fine for all new posts and WordPress-generated links to older ones but completely broke all the manually-entered links in nearly six years’ worth of previous posts and comments! So, being aware that these links were broken but not why, I set about fixing them and ran a series of MySQL queries to strip the category names from ‘post_content’, ‘comment_content’ and ‘comment_author_url’ table columns. Which, despite correcting the URLs to what I thought I’d set up, was still baffling me this afternoon by not fixing the broken links. And then it hit me… the new ‘post name’ format was not the same as just stripping the category from the one I’d had, and, having twigged that simple and now-so-obvious mistake, all should be hunky-dory again. I’ve even dealt with .htaccess redirects to take care of search-engine links to the old (category-inclusive) permalinks, so now just have to hope they’ve not got the whole blog reindexed too quickly with the December versions!

Might just add that I’ve also taken this opportunity to retrospectively file many previously mislabelled ‘climbing’ and ‘running’ posts under the new ‘walking’ category but, with my redirects taking care of the old category thing, shouldn’t have broken any older links from outwith the site by doing so.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog powered by WordPress. Feedback to webmaster@petestack.com.