How to Redirect WordPress Posts After Changing Permalinks

Date: 09/20/2019 2 Minutes to Read

In this article:

Some WordPress updates require more proactive work than others. Security plugins require detailed customization per your environment and usually provide activity logs for reactive changes. Accessibility improvements require user testing to ensure it improves user experience.

WordPress search engine optimization (SEO) requires time and research. A plugin like All in One SEO or Yoast SEO helps. But simply updating your WordPress permalinks from the longer day and name or month and name formats to a more concise option makes your URL’s easier to read and improves SEO immediately. Doing this correctly requires handling potential 404 – File Not Found errors as older links become invalid if not redirected somehow.

An .htaccess 301 redirect can suffice for new websites with only a few pages. However, seasoned WordPress sites would benefit from a plugin to manage these changes automatically with logs to help fix related issues.

Below we cover how to redirect WordPress posts after changing permalinks with Redirection.

Get better performance without additional plugins with our Nginx-powered WordPress Hosting.

Install Redirection

There are multiple ways to install the Redirection plugin. You can install the plugin manually or via WP-CLI (plugin slug redirection). Below we’ll use the WordPress dashboard.

  1. Log in to your WordPress dashboard.
  2. Install the Redirection plugin.
  3. Activate the plugin.

Setup

  1. Hover over Tools and click Redirection.
  2. Read the Getting Started page and click Start Setup.
  3. (Optional) Select Monitor permalink changes in WordPress posts and pages. You can change these settings at any time.
  4. Click Continue Setup.
  5. If the REST API check is Good, click Finish Setup.
  6. Click Finished.
  • WordPress Permalinks section

Create Redirects

  1. Do NOT make any changes, yet. Decide your preferred permalinks but do NOT Save Changes.
  2. Once you decide on your preferred settings, you need to find the correct Regular Expression (regex) input for your redirect settings. Below are some common changes:
    Day and Name to Post name:
    Source: /^/\d{4}/\d{2}/\d{2}/(.*)
    Target: https://domain.com/$1/
    Example: https://domain.com/2019/09/20/about
    Becomes https://domain.com/about

    Domain to /blog except URLs with /blog:
    Source: /^/(?!blog)(.*)
    Target: /blog/$1
    Example: https://domain.com/about
    Becomes https://domain.com/blog/about

    Old domain to new domain:
    Source: /(.*)
    Target: https://newsite.com/$1/
    Example: https://domain.com
    Becomes https://domain.net
  3. (Optional) Read more about Regex options on the developer’s website – Redirection.me.
  4. Configure your permalinks and Save Changes.
  5. On the left, hover over Tools and click Redirection.
  6. Under Add new redirection, add your Source URL regex and select Regex from the URL options / Regex drop-down on the right.
  7. Type your Target URL and click Add Redirect.
  8. Test your redirect.

Improve your SEO by checking the Redirection logs.

Leave a Reply