1. Home
  2. Docs
  3. Plugin settings
  4. Canonical & old slug redirect

Canonical & old slug redirect

The main purpose of Permalink Manager is to allow WordPress users to edit the permalinks. As you may know, the URL changes may lead to 404 (“not found”) error. To prevent this from happening, the plugin will automatically redirect the old permalinks.

You can deactivate both “Canonical redirect” and “Old slug redirect” in Permalink Manager settings. These functionalities are available also in free version of plugin (Permalink Manager Lite).

Canonical redirect in Permalink Manager

The canonical redirect functionality is a integral part of WordPress codebase. The main purpose of this feature is to redirect from original (native) to canonical permalinks. In other words, WordPress tries to “correct” the requested URL and send a visitor to the actual URL address.

Old URL | https://example.com/?p=123
Redirect target URL | https://example.com/canonical-permalink-of-page-with-id-123/

This functionality could be helpful, after you use Permalink Manager to adjust permalinks. The plugin will automatically trigger the canonical redirect whenever the original/native URL address is requested:

Old URL | https://example.com/shop/old-original-product-permalink/
Redirect target URL | https://example.com/new-url-set-with-permalink-manager/

The native permalink (team/john-doe) was used before Permalink Manager was installed. It will lead to new custom permalink (staff/john-doe) set in Permalink Manager.

Old slug redirect

Old slug redirect” works in a similar manner to canonical redirect. Old slug redirect is used to provide a fallback for old slugs. Shortly, every time you change the slug, WordPress will save its previous version as a custom field ( _wp_old_slug).

Old URL | https://example.com/old-native-slug
Redirect target URL | https://example.com/new-updated-native-slug/

If you turn “Old slug redirect” on, the function will check if requested slug is linked to any post. If it is, WordPress will trigger redirect to the correct permalink.

This particular functionality is rarely used and is not reliable. As mentioned above WordPress saves the old slugs in wp_postmeta table using ‘_wp_old_slug’ meta key. The other problem here is that there is no easy way to list all the saved slugs that will trigger the redirect.