SOP 051: How to Implement and verify a 301 Redirect on a WordPress website
Goal:
To properly implement and test 301 redirects on your WordPress website.
Ideal Outcome:
The page you want to redirect no longer displays a 404 error or the old content and is now redirecting users and search engines to the new URL. Another outcome would be when other websites make typo errors in linking to your website, you can redirect the wrong backlinks to the correct URL.
Prerequisites or requirements:
This exact process only applies to self-hosted WordPress sites.
Why this is important:
Having users or search engines experience either 404 (Page Not Found) errors or outdated content should be avoided as much as possible.
Where this is done:
In your WordPress Admin panel.
When is this done:
Whenever unexpected 404 (Page Not Found) errors are detected, or you want to redirect users automatically and permanently from a URL to another.
Who does this:
The person responsible for website management, or SEO.
Environment setup
If you haven’t yet, you’ll need to install “Redirection” on your WordPress website:
- Log in to your WordPress Admin Panel.
- On the sidebar to the left, hover ‘Plugins’ 🡪 ‘Add New.’
3. On the top right corner type ‘Redirection’ on the search box.
Click ‘Install Now’ > ‘Activate.’
4. On the sidebar to the left, hover ‘Tools’ and click ‘Redirection’:
5. You will be redirected to the ‘Welcome to Redirection’ page, click ‘Start Setup’ button:
6. Next, you will see the ‘Basic Setup’ page:
Check ‘Monitor permalink changes in WordPress posts and pages’ – This is helpful in keeping track of URL changes (e.g., You may have a seasonal landing page like ‘Black Friday Sale 2020’ last year, ‘Black Friday Sale 2021’ this year -- you can keep track of the URL changes here).
Check ‘Keep a log of all redirects and 404 errors’ – This will help you identify backlink errors from other websites, or your website is being hacked when unfamiliar URLs are being logged here from search engines.
[Optional] Check ‘Store IP information for redirects and 404 errors’ – If you choose to put a check on this, you have to declare it in your privacy policy for GPDR compliance.
Click the ‘Continue Setup’ button.
7. Next, the Redirection plugin will check if there is no other plugin that will affect its functionalities. Most of the time, it will appear as ‘Good’ then you’ll be able to proceed to the ‘Finish Setup’ button. If REST API is ‘Disabled,’ you might need to disable the plugin causing it or get support to get it enabled.
8. Wait for the progress bar to reach 100% and click ‘Finished.’
9. Next, we’ll go over three very common redirect scenarios — click on the links below to the one that fits your needs:
Redirecting a single page
Redirecting an entire subpath to a specific page
Moving URL structure
Redirecting a single page
Note: Make sure you have a backup of your website when doing 301 redirects (or that you are doing it first on a staging environment), there is the small chance you might cause a redirect loop which can make your website unavailable. There is also the small chance your redirect rule matches your Admin login page, causing your Admin Panel to become inaccessible.
Remember: If you haven’t implemented a backup solution for your WordPress website, you can do so by following SOP 053 (web version).
Note 2: In rare cases, depending on the URL structure and your setup, the process covered in this SOP might not work for you. If this is the case, it is recommended to get in touch with a developer to find you a specific solution.
Typical use-case:
You were running a flash sale on a specific landing page and the sale has ended. You might want to redirect users to the current sales page now.
You detected a 404 error on your website and want to redirect users to a similar page that is working.
You want to create a vanity URL. An easy to remember and easy to type URL that you can give to your users that will redirect them to the actual page that you want them to go to. Typically used when you want users to be tagged with UTM tags, but you do not want the URL to display the UTM tags.
Note: If you are not using UTM tags already you can start doing so by following SOP 006: (web version).
You moved your website structure and now your old URLs are not working anymore. You want to redirect them to the new website structure.
Note: There are instances where you might not need to redirect every single page using this method. Even though it would work you may want to check if any of the other redirecting options covered on this SOP would work for you and if they would be more time efficient.
For off-page SEO benefit, you can also redirect backlinks from other websites that have URL typos in them to the correct or updated URLs.
Example:
http://www.asiteaboutemojis.com/old-page/
To
http://www.asiteaboutemojis.com/new-page/
Procedure:
1. On the sidebar to the left, hover ‘Tools’ and click ‘Redirection’:
2. Below the ‘Add new redirection,’ you can fill up the fields under it:
Source URL:
Enter your old URL.
Example:
http://www.asiteaboutemojis.com/old-page/
Remove the domain from it.
Example:
3. Remove the last forward slash (If it exists)
Query Parameters: “Ignore & pass parameters to the target” Note: If you don’t select “Ignore & Pass parameters to the target” it will still appear to work, but users that arrive at the page through an URL containing an URL parameter (like UTM tracking for example) will not be redirected.
Target URL: This is the new URL you want to redirect your visitors to, when they try to visit the source URL.
Example: http://www.asiteaboutemojis.com/new-page/
4.Click the gear ⚙️icon and Input the following fields. When you’re done click “Add Redirect”:
Title: This field is for internal use only. It should explain why this redirect was implemented.
Example: [Discontinued Product] Blue Emojis
Match: URL Only
When matched: Redirect to URL
With HTTP Code: 301 - Moved Permanently
That’s it! Your redirect should be ready, you should now test if it is working properly by following the last chapter of this SOP — “Testing if redirects are working properly”.
Redirecting an entire subpath to a specific page
Note: Make sure you have a backup of your website when doing 301 redirects (or that you are doing it first on a staging environment) – there is the small chance you might cause a redirect loop which can make your website unavailable. There is also the small chance your redirect rule matches your Admin login page, causing your Admin Panel to become inaccessible.
Remember: If you haven’t implemented a backup solution for your WordPress website, you can do so by following SOP 053 (web version).
Note 2: In rare cases, depending on the URL structure and your setup, the process covered on this SOP might not work for you. If this is the case it is recommended to get in touch with a developer to find you a specific solution.
Typical use-case:
You used to have an entire category on blue emojis being sold on your website but you no longer sell those. You might want to redirect all those product pages beneath it to the main category with similar products (violet emojis).
Example:
Redirecting all the product URLs that were under the subpath:
http://www.asiteaboutemojis.com/blue-emojis/
To
http://www.asiteaboutemojis.com/violet-emojis/
So, in this case, if there was a “blue emoji” product in the URL:
http://www.asiteaboutemojis.com/blue-emojis/product1
Then you will be redirecting users who try to access that link to:
http://www.asiteaboutemojis.com/violet-emojis/
Procedure:
1. On the sidebar to the left, hover ‘Tools’ and click ‘Redirection’:
2. Below ‘Add new redirection,’ at the right side of the ‘Source URL’ field, click the ‘URL options/Regex’ toggle and check ‘Regex’:
Source URL:
Enter your base URL for that category:
Example:
http://www.asiteaboutemojis.com/blue-emojis/
Remove the domain from it.
Example:
Add ^ at the start and add the characters (.*) at the end.
Example:
^/blue-emojis/(.*)
Target URL:
Enter your new URL.
Example:
http://www.asiteaboutemojis.com/violet-emojis/
Remove the domain from it.
Example:
3. Click the gear ( ⚙️) icon next to the blue “Add Redirect” button.
4. Input the following fields and when you’re done click “Add Redirect”:
Title: This field is for internal use only. It should explain why this redirect was implemented.
Example: [Discontinued Category] Blue Emojis (All pages) → Violet Emojis Main Category
Match: URL Only
When matched: Redirect to URL
With HTTP Code: 301 - Moved Permanently
That’s it! Your redirect should be ready, you should now test if it is working properly by following the last chapter of this SOP — “Testing if redirects are working properly”.
Moving URL structure
Note: Make sure you have a backup of your website when doing 301 redirects (or that you are doing it first on a staging environment) there is the small chance you might cause a redirect loop which can make your website unavailable. There is also the small chance your redirect rule matches your Admin login page, causing your Admin Panel to become inaccessible.
Remember: If you haven’t implemented a backup solution for your WordPress website, you can do so by following SOP 053 (web version).
Note 2: URL structures are typically well handled and correctly redirected by WordPress simply by either renaming your category (Under “Posts → Categories → Select “Quick Edit” under the category you want to change → Change the Slug to the name of the category you want to rename) or changing your URL structure. (You can change your URL structure by following SOP 050 (web version)
Typical use-case:
You moved the URL structure on your website and now you found 404 errors (Page Not Found) on your old URLs.
Example:
Renaming categories, such as changing the name of the category slug from /business/ to /enterprise/ and keeping all the old URLs downstream to redirect to the new slug.
Example:
Redirecting all the blog posts that were previously under the subpath:
http://www.asiteaboutemojis.com/business-related/
To
http://www.asiteaboutemojis.com/enterprise/
So, in this case, if before changing the URL structure a typical blog post URL would be:
http://www.asiteaboutemojis.com/business-related/we-do-awesome-301-redirects
Then you will be redirecting users to:
http://www.asiteaboutemojis.com/enterprise/we-do-awesome-301-redirects
Procedure:
1. Log in to your WordPress Admin Panel.
2. On the sidebar to the left, hover “Tools” and click “Redirection”:
3. Under “Add new redirection”, tick the “Regex” checkbox, and input:
Source URL:
Enter your old URL.
Example:
http://www.asiteaboutemojis.com/business-related/
Remove the domain from it.
Example:
Add the characters ^ at the start and (.*) at the end.
Example:
^/business-related/(.*)
Target URL:
Enter your new URL.
Example:
http://www.asiteaboutemojis.com/enterprise/
Remove the domain from it.
Example:
Add the characters $1 at the end.
Example:
4. Click the gear (⚙️) icon next to the blue ‘Add Redirect’ button.
5. Input the following fields and when you’re done click ‘Add Redirect’:
Title: This field is internal only. It should explain why this redirect was implemented.
Example: [Renamed Category] Business to Enterprise
Match: URL Only
When matched: Redirect to URL
With HTTP Code: 301 - Moved Permanently
That’s it! Your redirect should be ready, you should now test if it is working properly by following the last chapter of this SOP — “Testing if redirects are working properly”.
Testing if redirects are working properly
1. On your browser, go to http://www.browseo.net/
2. On the input box on the top left, insert the URL you want to test → Click “Browse”
3. On the input box on the top left, insert the URL you want to test → Click “Browse”
4. When the tool loads the results, you should be able to see under “Response” the redirects one by one, and what kind of redirect it is.
5. If you followed this SOP to implement the redirect you should be seeing “301 Moved Permanently”.
Note: If you see a 404 (Not-found) instead, it means your website is not redirecting successfully. There are multiple reasons why this could be happening, if you have just implemented the redirect and you are using a “Cache” plugin, you might want to refresh your website’s cache and try testing again.