This WordPress hack is one that I planned on writing write after the last one about rotating and recycling posts out of your archives and on to your home page. Mainly because there is one thing I didn’t address before, and that’s you permalink structure. In WordPress your “permalink” structure is your URL. By traditional default WordPress blogs have a day, month, year structure to the URL like this:

www.site.com/05/01/2008/my-new-post

In your WordPress dashboard in either settings (WP 2.5) or options (before WP 2.5) -> “Permalinks” you have the ability to change the structure to whatever you want. In the beginning (because they don’t know any better) most people don’t and leave the date default. Even Matt Cutts says don’t use post dates in URL’s. Why not?

WordPress Hack #10 should have been a prime example – if you’re going to be recycling your old posts to the home page, it’s going to change the published date to the current day – right? Well, it won’t change the permalink (URL) – and it will still reflect the old date. You could change the permalink structure manually in your dashboard, but that would just create new URL’s for every single post (removing the date portion), so every single bookmark and every single search engine listing you ever had will now be an “Error 404″ page. Ouch!

Over time if you write new posts every day or every week you probably aren’t going to want the post dates to matter as much, since new readers will be coming on board all the time. In addition – maybe you’ll want to move out of WordPress to another blogging platform someday that doesn’t have a date based post convention. If you’re in the same boat I was, you are now in quite the predicament – what to do, what to do?? Once again, enter a lifesaver WordPress plugin “Dean’s Permalink Migration!” It’s very simple to use, and will solve all your permalink problems.

First install and enable the plugin. Then in options or settings -> “PermalinksMigration” in your WordPress dashboard you’ll see a simple text field for only one option:

All you have to do is enter your OLD permalinks structure in that field. For most of you that’s going to be:

/%year%/%monthnum%/%day%/%postname%/

What I did was open up two tabs in my browser, both with my WP dashboard open. In one tab I had settings -> Permalinks and the other settings -> “PermalinksMigration”. I just copied and pasted my “permalinks” structure to “permalinksMigration”. Then in “permalinks” I changed the structure from this:

/%year%/%monthnum%/%day%/%postname%/

to this:

/%postname%/

Then I click “update” to save each tab, one immediately after the other. To recap- what I’ve done here is removed the dates from my permalink (URL) structure, and the “Dean’s Permalink Migration” knows what my “old” structure was, and it will automatically redirect each and every page using old date based structure to the new page. You won’t lose any hits from bookmarks or search engines at all, and all of your URL’s will be much cleaner and shorter from now on.

The ONLY drawback I could think of was, this plugin only works ONE TIME. Since it only has one field for previous permalink structure to redirect – it can only redirect the last change you made. Hint to the plugin auther, you could hack this plugin to allow for multiple changes, and adding the ability to do the same for category permalinks would be a boon too!

Now I can just hear somebody screaming from the back of the room “what about my pagerank, what about my pagerank!”. In effect, to search engines, indexers, and crawlers this should be the same as a 301 permanent redirect. If you had pagerank assigned to any of your individual posts, it should transfer to the new URL over time – typically from a few weeks to a few months depending on google’s update schedule. I personally really don’t worry about pagerank anymore at all – you probably shouldn’t either.

I hope that this hack helped you as much as it helped me once found it. If you have any comments to make this post better, or question – please comment now!

it doesn’t matter how familiar you are with WordPress, if you change your WordPress permalinks without this plugin you screw up all your search listings and anyone who clicks on one or uses a bookmark with get a 404 error. There is no convention in WordPress to accomodate for changing permalink structure and redirecting the old URL’s to the new structure. It has nothing to do with being lazy.

If you were familiar with WordPress, you’d know that when you make a comment, you don’t have to include a link back to your site in the comment, because you automatically get one at the top of your comment. Since I have CommentLuv installed you even get a link back to your last post in your RSS feed!

I’m happy I learned about permalinks before starting any WordPress sites!!!!

I dead a ton of reading on it. There are all kinds of opinions. I ended with domain/%postname%/ only. For the very reasons JT talks about. I didn’t want to end up having to redirect everything at some future point. The one knock I heard about this permalink structure is, it slows down the database?!?!?! I have no idea if that is true. The person stated it on a forum and insited that an ID must be put with it. Well, after viewing tons of WordPress sites that rank well I noticed they didn’t bother with the ID. . . maybe I’ll end up with a slow database. . . don’t know but I would think this issue would have been brought up to the WP programmers.

Quick question: When I change the permalink structure on my WordPress 2.5 blog to /%category%/%postname%/, the old posts’ url doesn’t change. The links seem to all work, but the url stays the same. What am I missing?

[...] your posts doesn’t change when the old posts are “shifted” to the home page. Read How to change permalink structure seamlessly if that situation applies to you. Want automatic updates? Subscribe to our RSS feed or Get [...]

@Jason – first of all, tell your client that he’s nuts, and in today’s day and age there’s no reason to have any page end in “.html” because google just doesn’t care. I mean, come on – google can even index flash files now. That’s like giving someone a piece of bread, and telling them to call it’s a “biscuit”. They don’t care what you call it – they know when they’re eating it it’s still a piece of bread.

In any event, if you client still insists on being a stubborn little know-it-all…you can still do this. Just change your permalink from /%postname%/ to /%postname%.html and I believe that should do it!

@Chad – personally I think that paragraph is a ridiculously old and outdated piece of information that should be removed. It even questions itself with the (is this true with WP 2.0+) mention within it. It was written way back in the days of WP 1.x.

About 2 years Matt Cutts wrote a post saying that WordPress sites should “drop” the date based permalinks and to postname only after the URL because it was better for SEO, and better if you (later) restructure your blog or site. I have to say – he gave great advice, it’s been working for me.

I was thinking about it because tags usually have more identification with the content than the category – that’s normally more generic.
And a post can have more than one category too.
Maybe WordPress should have one option where we could set one tag as the most important and it could be used in the permalink.

@Dudu – Maybe you misunderstand how tags and categories work. Each tag has it’s own page, and each category has it’s own page, and posts (in those tags and categories) are listed on their assigned pages. It would be redundant to have /%tag%/%postname%

Also, ever tag and category assigned is usually listed in the meta of the post, it would be of no use to have it in the URL, and of very little use SEO wise.

Great point about post dates. It seems like the best idea is to leave them out of the URL–even though I still include them on one site I run. But it makes sense to not have the dates there and instead just have the keywords from your post title. Much cleaner looking too.