Logo Pupungbp.com

Need a WordPress expert help?

Redirect From Old URL to New URL Format in WordPress

Last Updated: January 4, 2021 | Reading Time: 2 minutes

Working on redirect from old URLs to the new one in WordPress is quite simple, this technique is useful to keep the traffic going to the correct post if you have changed your URL. Here are steps on how to set up a redirect with simple REGEX command to bulk redirect posts to new URLs.

Setup the Plugin

First step is to install the Redirection plugin. This is my most favorite plugin for logging 404 and redirect them into the correct urls.

Once it set up, go to the plugin settings, tools > redirection, and add new redirect, and activate the regex option

Setting up Regex using plugin
Adding Regex for Redirection

And paste the regular expression (Regex) syntax below. Here are some commons regex use interm of default WordPress permalink.

Adding regex redirection example
Example how to add regex redirect

Redirect from Date (Year/Month/Date) Format to Archive Format

Old date based-format like this:

SOURCE URL: /2019/02/28/mammoth-hello-camp-2019/
REGEX: ^/\d{4}/\d{2}/\d{2}/(.*)

Redirect to:

TARGET URL: /archive/mammoth-hello-camp-2019/
REGEX: /archive/$1/

Redirect all url on this site to new site address.

OLD URL: /mammoth-hello-camp-2019/
REGEX: /(.*)

Redirect to new site address:

TARGET URL: https://newsite.com/mammoth-hello-camp-2019/
REGEX: https://newsite.com/$1/

Redirect all URL Except wp-admin

SOURCE REGEX: ^\/((?!wp-admin).)*$
TARGET REGEX: https://newsite.com/$1/

Looking for an affordable WordPress solution?

We offer budget-friendly WordPress website development services to meet your needs. Prices start at $10.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.