20

When I change a slug from post-a to post-b, will WordPress create a redirect from /post-a to /post-b, like HTTP 301 or something similar? If not, is there a plugin for that?

2 Answers 2

15

I just went and tested this (WP 3.3.1), the wordpress core will automatically do a redirect if you change the post slug, even if you change the slug from post-a to post-b and then to post-c, post-a will return a 301 to post-c. That said, the redirection plugin that Mike Jolley recommended is an outstanding plugin and a great way to monitor for 404 errors and such.

3
  • 5
    Just to add a note, this built-in redirection doesn't work when the part of URL that is not the slug changes, e.g. when the pattern is /[year]/[month]/[date]/[slug] and the date changes, WordPress will not create a redirect. A plugin is necessary in that case. Commented May 30, 2012 at 20:59
  • Where abouts in the DB is this redirect rule saved? Cheers
    – ejntaylor
    Commented Apr 24, 2018 at 9:52
  • @raison it's in wp_postmeta table and meta_key is _wp_old_slug. with this query you can see all of them SELECT * FROM `wp_postmeta` where meta_key = "_wp_old_slug". Commented Aug 27, 2021 at 13:51
5

This plugin can be used to monitor URL changes like that and set up redirection automatically:

http://wordpress.org/extend/plugins/redirection/

2
  • 2
    If only it worked :( I ended up using wordpress.org/extend/plugins/quick-pagepost-redirect-plugin though it lacks some features. Commented May 30, 2012 at 21:02
  • 1
    Yes, it did work perfectly until at least the middle of 2012 on one of my fairly complex WP installs (always autoupdated as new stable releases are pushed by WP). However something's broken in its autosensing routine for when slugs are modified, I only just noticed today on a 3.5.1 install so can't be sure when this it first stopped automatically adding rules for modified slugs. That's a shame. :( Guess we should all donate to the dev to encourage him to fix the bug! Commented Feb 15, 2013 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.