Permalinks, Link Rot, Google PR: A Solution To The Nightmare

One of the biggest topics in the blogsphere today is SEO, search engine optimization, a concept that is fairly important if you want your website/blog to be popular on the web. For this post, I’m not going to be focusing so much on SEO, even though this has to do with SEO, but rather on just permalinks.

A little background history: I started using WordPress at about version 1.3/1.5 and it worked out great for me. My permalink structure was pretty straightforward: At about the time of WordPress MU 1.0/1.2 was introduced, I decided to switch to WPMU because I felt it would be easier to manage my growing list of blogs. To my dismay, that the permalink structure changed a bit. My permalinks were now which would sometimes be so long that you couldn’t even see the entire URL in the address bar. Unfortunately, at that time, there was no way to get rid of the /blog/ virtual directory (there was, my skill wasn’t that good then to do it), so I stuck with it. Since then, I’ve stuck with the /blog/ on my site. Future sites hosted under my WPMU install did not suffer the same fate because of changes in the core, but I never got around to changing my main site’s permalinks. At some point, it becomes a scary undertaking to redo your permalinks because it can lead to link rot and Google Page Rank penalties because URLs, theoretically, should remain the same indefinitely.

So recently, I decided to bite the bullet. I was tired of having URLs longer than the Nile River. Argubly, shorter URLs tend to rank better in terms of SEO, but from a user stand point, I rather see something like http://domain.tld/2008/08/look-how-pretty-this-looks (what I’m using now) versus http://domain.tld/blog/2008/08/13/look_how_pretty_this_looks.php (what I was using).

So What Was The Problem

I wanted to shorten my URLs from to something short, descriptive, and pretty such as losing the virtual directory blog, the day and the PHP suffix (since it’s not really necessary). With over three hundred posts, a permalink mistake can cost me dearly with Google. I figured I could at least take care of the /blog/ issue by removing it from the permalink structure under Dashboard > Settings > Permalinks, but that gave me tons of 404 Not Found errors from search engines: a huge nightmare. So I had to change it back.

What It Took To Make It Happen

Ultimately it took two WordPress plugins and some trial and error, but it’s working correctly now. The two plugins I used was:

Originally I thought Dean’s Permalinks Migration did the trick, but while it works great rewriting links on your website, it does nothing for the referrers and search engines and displays nice 404 Not Found errors for those visitors. Grrrr. So with some reading, Redirection fit the bill. It did everything I needed, took care of the internal rewrites, referrers, and search engines, BUT it couldn’t take care of the PHP suffix on all my old posts! But with both plugins, I made it work.

First, I used Redirection and created two rules:

Source URL: /blog/(.*)
Target URL: /$1
Regex: checked
Source URL: /(d*)/(d*)/(d*)/(.*)
Target URL: /$1/$2/$4
Regex: checked

So what the first rule does is take any URLs with /blog/ and anything else after it, (.*) and strips it down to just the text after /blog/, hence /$1. The second rule is for the day issue. After /blog/ is stripped, there is still the /year/month/day/ issue. So the second rule says if the URL has /year/month/day, /(d*)/(d*)/(d*)/ and everything else after wards, (.*), reduce the URL to /year ($1)/month ($2)/post title ($4)/. Perfect! Except, there is still the PHP suffix issue.

That’s where Dean’s Permalink Migration comes into play. Under Dashboard > Settings > PermalinksMigration, I put /%year%/%monthnum%/%postname%.php into the Old Permalink Structure. Obviously under Dashboard > Settings > Permalinks I have /%year%/%monthnum%/%postname%/.


So far everything looks like it’s working out fine. Google has been good about slowly updating my old permalinks to reflect the changes, but it’s always good to have a permalink redirection in place for people with outdated bookmarks and what not. Plus it’s just good interneting.

I could also do the same thing via the .htaccess, but I think it’s better to utilize plugins because everything is one place and easier to manage. This is what makes WordPress so great, the expandability and flexibility of what it has to offer.

Leave a Reply

Your email address will not be published. Required fields are marked *