Redirect Old Slugs

About

If you are using “fancy permalinks” in WordPress, part of that permalink will be a “slug,” an all-lowercase dashed version of your post title… like this-is-a-slug. This becomes part of your permalink… and so it cannot change. But what if you decide you want to change it? What if you made a spelling error in your title, and don’t want the permalink’s slug to remain misspelled for all of eternity? You could either just change the slug, and have old links to the post break, or you could go through the trouble of setting up an Apache redirect for the old link to the new one.

This plugin was created to fill that need. Now you can change your post or page slugs with impunity. The plugin will notice when you change the slug of a published post or page, and it will save the old slug as a custom field (the key is old_slug). Now, when someone tries to go to the old post, the plugin will say “hey, that looks like one of the old slugs I saved, let me redirect you to the new location.” Thus, none of the links made to the old permalink are broken. You can change the slug multiple times… and all the old versions will forward to the current link.

Redirect Old Slugs has been tested on WordPress 1.5.2 and the in-development WordPress 2.0.

Note

This plugin’s functionality has been added to WordPress core as of version 2.1, so please deactivate the plugin if you have WordPress version 2.1 or higher!

Download

Instructions

  • Download and unzip
  • Upload redirect-old-slugs.php to your /wp-content/plugins/ directory.
  • Activate it from within the WordPress admin interface.
  • From now on, you can edit slugs without worry! If you have an old post whose slug you changed (prior to installing the plugin), you can manually add an old_slug Custom Field for that entry, and it will be forwarded.

Versions

  • 0.3 Plays better with other plugins, creates post_meta entries more intelligently
  • 0.2 Added support for MySQL < 4.1
  • 0.1 Initial release

I’ve spent a lot of time writing this code and supporting it. If you derive some benefit from this code, please consider showing your gratitute in a more tangible
way. Thanks!

I have received $0 this month for my coding efforts.

Donate with PayPalAmazon.com Wishlist


120 Responses to “Redirect Old Slugs”

  1. I want the post to still keep showing up so that anyone who comes to it via search, for instance, will now see the additional content and the new title. I might still change the permalink but, with the help of a nifty WordPress plugin called Redirect Old Slugs, do it in a way that the change will be wholly transparent and not affect the post showing up in all the right places including search engine results. Actually, I can’t really see any value in changing it. Can you?

  2. es ver como estas dos direcciones llevan a un mismo artículo: http://bruto.muzaidin.com/archivos/2004/taliban-del-rock/blind-melon-soup-1995/ http://bruto.muzaidin.com/2004/blind-melon-soup-1995/ Redirect Old Slugs: Otro gran plugin que ya viene por defecto como función a partir de WP 2.1, pero que para los que estamos todavía en la rama 2.0.x es muy útil. La función es la misma: redireccionar, aunque la utilidad que le he dado es diferente. Lo que te permite

  3. Trakin (subscribed) says:

    Now this one is a very thoughful plugin. You can visit your old slugs and make new ones based on new popular keywords. A very good SEO technique I must say. However, I am going to try first with one of my old posts and wait to see the results. If it works properly- It will be really helpful. Thanks for your work !

  4. [...] in one easy plugin. 11. Protected Downloads Restrict and track downloads from your blog. 12. Redirect Old Slugs Change your post slugs without breaking the old ones (which redirect to the new ones. 13. Related [...]

  5. [...] 7http://www.webservis.gen.tr/Kategori/Genel/Genel/Genel.php4 8http://txfx.net/code/wordpress/redirect-old-slugs/5 9http://www.taytanik.com/3 10http://txfx.net/code/wordpress/gravatar-signup/5 [...]

  6. [...] Redirect Old Slugs v0.3 by Mark Jaquith … Allows you to change your post slugs without breaking the old ones (which will redirect to the new one!) [...]

  7. … Breaks down comments into a number of pages Post Templates by Category vR1.3 by Kaf Oseo … Use custom single post templates for specified categories. I use this to track the traffic and earnings of my guest editors.Redirect Old Slugsv0.3 by Mark Jaquith … Allows you to change your post slugs without breaking the old ones (which will redirect to the new one!) Show Top Commentators v1.05 by Nate Sanden … Encourage more feedback and discussion from readers, by rewarding them

  8. [...] Skype | pacificIThttp://www.pacificit.ca/article/319 Matt Ortegahttp://mattortega.com/ Redirect Old Slugs [ Tempus Fugit | TxFx.net ]http://txfx.net/code/wordpress/redirect-old-slugs/ Earthmovers and [...]

  9. Bornheim says:

    Thanks for this plugin – in any case! Jürgen

  10. [...] Redirect Old Slugs Pekar om gamla blogginläggsadresser (permalänkar) till de nya, exempelvis /?233 till /bilder-på-min-katt. Gäller dock att du har bytt från standard-länkar, kan ändras under settings > permalinks [...]

  11. Steve says:

    If this works you’re a magic man.

  12. Steve says:

    Oops… I’m running higher than 2.1 so I already have this… I’ve never tested it out, though. I’ll have to try that. :-)

  13. dreamfree says:

    sounds great~ but if we can modify the slug immediately, the google can thus not index the older one:)

Leave a Reply