As a follow up to yesterday’s post about WordPress permalink structure (where a good discussion took place in the comments), I decided today that I would dedicate a post to showing you how to switch your blog’s permalink structure without creating any invalid URL’s.

The easiest way to accomplish this is to grab the Permalink Redirect plugin (my plugin review here) and activate it. Once activated, when you go into the Settings panel you should find a new tab called Permalink Redirect. Scroll down to the bottom of the page and you should see this:

In the old permalink structures box, you can paste your current permalink structure there (depending on which you choose, something like /%year%/%monthnum%/%day%/%postname%/). If you are unsure what exactly to type, please refer to the permalink page on the WordPress Codex.

Now save and go to the Permalinks tab. Select the custom field and type /%postname%/, then save.

Now go to an old URL and it should automatically redirect you to the same post’s new URL.   The search engines will see the 301 redirect and update accordingly!

Any questions? Feel free to comment below!

Update: I believe the plugin has changed since this was written.  If you are comfortable updating your .htaccess file, you can instead redirect all your links to the new /%postname%/ url by adding the following:

RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.domain.com/$4

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching WPHacks.com as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. Ronny-André says:

    The plugin fails to activate on my server:

    Fatal error: Cannot redeclare wp_redirect() (previously declared in /wp-includes/pluggable.php:673) in /wp-content/plugins/ylsy_permalink_redirect.php on line 304

  2. A.J. says:

    How long do you have to keep this plugin active until you’re sure that the search engines have discovered your new permalink structure?

  3. Or get Urban Giraffe’s Redirection or Advanced Permalinks plug ins.

  4. Kyle Eslick says:

    @ Ronny – Not sure why that is happening, I’ve never had any problems with this plugin on any of my blogs. It is probably a problem with your webhost. See some of the suggestions below!

    @ A.J. – If you are just using it for a redirect, then you can just wait until the search engines update. However, if you de-activate it, any inbound links would become 404 errors so you should keep it active for quite awhile, if not permanently. It also does a 301 Redirect for your www and non-www and adds the / to your URL’s for consistency.

    @ Rob – Thanks for the other recommendations. I like Permalink Redirect because it also does a Feedburner feed redirect as well. (Though those might also, I haven’t tried them)

  5. Richard H says:

    After yesterday’s post I gave the url redirect plugin a try and got the same error as Ronny.

    I made the permalink change and the redirect worked without the plugin. I haven’t checked yet, but does 2.5 have this ability now?

  6. Kyle Eslick says:

    @ Richard – Good question. I haven’t tried this since WordPress 2.2 or so. I’ll see if I can get it answered here shortly!

  7. @Kyle: If I’m not mistaken, Urban Giraffe’s Redirection plug does a Feedburner feed re-direct, too.

  8. Matthijs says:

    I am not sure if it’s a good idea if everybody suddenly switches their permalink structure.
    1) First, were is the evidence that urls without dates are better, SEOwise? So far I’ve only read some subjective opinions on this. As is often the case with SEO issues.

    2) Don’t forget that URLs with dates can be (very) useful for users. Seeing /blog/2008/03/31/new-dvd-players or /blog/2003/01/03-newest-dvd-payers gives me, as a user a lot of important information!

  9. Ronny-André says:

    @Matthijs: URLs with dates can be very effective in the matter you present it, but it can confuse as well. An example is, it’s different how we date things in Europe and the US. YYYY/MM/DD and YYYY/DD/MM is two very diffrent things.

  10. Kyle Eslick says:

    @ Rob – Thanks! I certainly wasn’t saying that Permalink Redirect was the only one, was just pointing out some of the reasons I like it.

    @ Matthijs – First of all, these opinions are from Matt Cutts, the lead guy with the Google search team. If your site wants traffic from Google, his opinions probably matter the most. 8)

    Matt also mentioned to make dates visible in your posts, but not in the URL. People should be able to get the date from the post if they want it, though on some of my sites I avoid the date all together because over time posts that stay popular years later can sometimes still be very valid but will lose credibility with readers if they see its a few years old. Really just a judgment call based upon your website and your preferences.

    @ Ronny – Great point as well. I’ve also been meaning to test and see if you publish a post then a few days later go in and change it to a different date, if the URL remains the same. I assume it wouldn’t change, but never confirmed. Same goes for people with categories in their post URL’s.

  11. Kyle Eslick says:

    Oh, as for people wondering if you should change your permalink structure, that is really up to you. This blog was designed more as a place to provide resources and explain how to do things rather than getting into whether you should or not.

    I have my opinions that I share sometimes in my posts, but I more or less just want to explain how to do stuff. I leave much of the advice stuff to other blogs. :mrgreen:

  12. Words Within says:

    Thanks so much for this – couldn’t be easier!

  13. HerveK says:

    Hy From France .
    My Website is on a Windows server.
    How can i have
    Old Permalinks like http://www.hkrag.fr/blog/?p=217
    and Too use /%postname%

    I can have after more and more tests :
    http://www.hkrag.fr/blog/index.php/sample-post/
    but too old link p=217 never continue to be Ok

    What to write please and where ?
    (scuze for my poor english 😉

  14. Alex says:

    I am planning on turning my main site into a magazine-style site, and also keep my current blog linked to it in a folder domain/blog. Is there anyway to use this plugin to do a URL redirect after I move my blog to the new folder? I have five + years worth of blogging and would hate to lose the old links.

  15. Rachel says:

    You are an absolute STUD 🙂

    I changed all my permalinks and used the Permalinks plug in and it was a NIGHTMARE. Couldn’t get anything to redirect as I couldn’t figure out what to put in the Old Permalink Structure box in the plug in.

    I read the instructions for the Permalinks plug in, as I knew I was doing something wrong, but could NOT figure it out as he might have created a fabulous plug in but he’s AWFUL at writing instructions. LOL.

    So, I came back here. Found this page to figure out what to put in the Old Permalink Structure box on the plug in and, voila, all fixed 🙂

    Thanks a ton. Awesome directions!!

Trackbacks/Pingbacks »

  1. Brève Wordpress 03: shortcode, SEO, sécurité, … says:
  2. 100+ Killer Wordpress Resources | Steffan Antonas’ Blog says: