Looking to set up bulk 301 redirects on your WordPress website to handle anything from a permalink structure change all the way to site architecture improvements?
Nobody likes broken links, which is why whenever you (permanently) change the original location of a webpage to a new one (where it’s still accessible), a 301 is the best & most suitable way to direct visitors to the new, updated page.
In this guide, we’ll take a look at:
1. What Is A 301 Redirect?
A redirect that returns the HTTP response code 301 Moved Permanently is used when the location of a resource (i.e. a webpage) is updated with the intention of being changed permanently. This is perfect for situations where you need to change the URL of a page on your website that’s already been published (and may also already be ranking in search results).
Common examples of scenarios in which using 301 redirects is an excellent choice include when a page isn’t relevant, useful, or has been moved, as well as after a site rebuild when URLs change – by changing permalink structure or overall site architecture. It is very important to avoid losing organic traffic due to the effects on SEO to implement redirects as soon as possible after the location of resource changes or is altered.
Note: It is important to note that canonical URLs are different and should be used in different situations. Learn more about canonical URLs here.
2. The Difference Between 301 Redirects & Other Redirects
A 301 redirect is specifically for permanent changes or changes that are intended to be permanent at the time of being made. In contrast, the purpose of 302 and 307 redirects are both designed for situations in which you wish to forward traffic to a new URL temporarily. In other words, if you’re looking to direct visitors to an alternative page temporarily but then intend on bringing the original URL back at some point in the future, use a 302 redirect.
While in the case of a 301 redirect, the intention should be that the change is considered permanent.
Here’s a brief overview of the different redirect types:
|Redirect Type||Description / Usage|
|301 (Permanent)||A permanent redirect is used in a number of scenarios such as when deleting a page (to redirect traffic to the next logical location) or when the original location of a resource is altered.|
|302 (Temporary)||A 302 redirect lets search engines know that a website or page has been moved temporarily.|
|303 (See Other)||The 303 redirect status response code indicates that the redirects refer to another page (such as a confirmation page or an upload progress page). This response code is usually sent back as a result of PUT or POST|
|307 (Temporary)||A temporary redirect – as above, is often used in more complex development environments such as when processing credit card payments and redirecting visitors to ensure that them refreshing their page doesn’t resubmit the checkout form.|
|308 (Permanent)||There is no real difference in implementation with the use of the 308 redirect except that a 301 redirect does not allow changing the request method from POST to GET while a 308 does (since it repeats the request using the new URL).|
Learn more about the different types of redirects here.
3. The Effects of 301 Redirects on SEO (and Traffic)
Google officially recommends using 301 redirects in the case of domain name migrations and the other scenarios we’ve suggested. And, as such, they have advised that 301 redirects (since considered permanent) can preserve PageRank. Meaning 301 redirects signal to search engines that the page still exists but just in a (slightly) different location – so they’ll be able to crawl and index the new page at the new URL to rank them as soon as possible.
In this video – which is still referenced to this day – despite being from 2013, Matt Cuts alludes to a loss of PageRank caused by using redirects. Google has since confirmed that this is no longer the case.
4. When To Use A 301 Redirect
A 301 redirect should be used when you’ve removed or deleted a page permanently from the website’s architecture yet want to preserve its traffic, rankings, and links.
Below are some of the examples where 301 redirects would be a good option:
- Moving a new domain permanently
Original domain: https://www.yoursite.com/
New domain: https://www.yournewsite.com/
- Moving a document or page permanently
Original “About Us” page: https://www.yoursite.com/about-us/
New “About Us” page: https://www.yoursite.com/about/
- Changing a site’s structure permanently
Original structure: https://www.yoursite.com/2021/07/post-name/
New structure: https://www.yoursite.com/post-name/
You, however, would not use 301 redirects for the following:
- A/B testing
- Device Targeting
5. How To Setup Bulk 301 Redirects
Now, let’s get onto the best ways to implement 301 redirects in bulk:
Method #1 – Using Rank Math’s Built-In Redirect Manager
With Rank Math’s Built-in Redirection Manager – managing 301 redirects couldn’t be easier. So without further ado, let’s help you set up your bulk 301 redirects.
[step 1] Install & Activate Rank Math
Every WordPress website needs a WordPress SEO plugin – ideally one that lets you take complete control of your website’s technical & on-page SEO. Fortunately, that’s exactly what we do here at Rank Math.
So, as you might’ve guessed, the first step – if you haven’t already – is to go ahead and install the Rank Math WordPress SEO plugin:
Note: Bulk redirections are possible in the free version of Rank Math but if you’re interested in learning why the best SEOs on the planet choose Rank Math PRO & Business to get a competitive edge, see how our plans compare here.
[step 2] Enable The Redirections Module
Next, since you’ve now installed Rank Math – while there’s nothing extra to install, you just need to head on over to Rank Math > Dashboard in your WordPress admin area in order to confirm that the Redirections module is enabled.
[step 3] Add A Single Redirect
Now that Rank Math is installed and the Redirections module is enabled, you’ll be able to navigate to Rank Math’s Built-In Redirection Manager by navigating to Rank Math > Redirections in your WordPress admin dashboard as shown below:
And then, you can go ahead and create a 301 redirect by simply entering the URL you wish to redirect as your Source URL and the location of the new resource (i.e. where you’d like to redirect the source URL to) as the Destination URL.
And once ready to activate, simply click Add Redirection.
Learn more about creating redirects in our documentation or in our detailed video tutorial below:
[step 4] Adding Multiple Redirects / Bulk Redirects
But that’s not all! You’re here to find out how to add 301 redirects in bulk. So that’s what we’re here for and let’s see how easy Rank Math makes this for you.
Option #1: Copy & Paste Multiple Source URLs
Depending on the scenario in which you are trying to create redirects in bulk – the first way to do this in Rank Math is simply creating a single redirect with multiple source URLs. Meaning that this would, of course, only work if each of these source URLs has the same intended, new location & destination URL.
Option #2: Updating, Editing & Importing Redirects via CSV PRO
Fortunately, we built Rank Math to make everyday, tedious and repetitive SEO work as easy as possible. So, in addition to being able to create 301 redirects in bulk by creating a redirect with multiple sources, you can also easily manage (add or modify) hundreds of 301 redirects, all of which have different sources and destinations in a matter of minutes.
Here’s exactly how to get started:
- Export Your Existing Redirect(s) to a CSVTo do so, navigate to Rank Math > Redirections and then selecting Import/Export – as shown below:Of course, in this scenario, we want to export the redirects first, this can be done by clicking the Export tab & then the Export CSV button:
- Open the CSV file in Google Sheets (or Excel)Now that you have your CSV file, it’s time to open it up in Google Sheets (if you want to collaborate with your team) or Microsoft Excel.
- Edit the CSV file to update redirects, create new onesEdit the CSV file to update the existing redirects, create new ones, or remove redirects that you no longer wish to have on your site.
- Import the CSV file using Rank Math’s Redirections ModuleAnd once you’re ready to apply your changes, simply navigate back to the Import tab in Rank Math’s Redirections Manager & upload your CSV file:
Note: Please proceed with caution as changes cannot be reversed. If you wish to have the option to undo all the changes made to redirects, we recommend taking a backup of your WordPress website before re-importing the CSV.
Option #3 – Using Regex (Advanced)
Regex – short for regular expression – is a string of text/syntax that allows you to create expressions that match certain text (i.e. ones that adhere to specific patterns). In the context of 301 redirects, this is incredibly useful as it means that you can create redirects in bulk simply by matching all URLs that fit into a certain pattern.
For example, if if you change your WordPress website’s permalink structure from Day and Name to a recommended structure such as /%postname%/ – you could add 301 redirects in bulk by using Excel & Google Sheets formulas along with Rank Math’s import/export options.
Or, you could alternatively use a simple regular expression. For example, here are some of the most common regular expression characters.
|*||Zero or more occurrences of the preceding element.||ab*cd matches “acd”, “abcd”, “abbcd”, “abbbcd”, and so on.|
|?||Zero or one occurrence of the preceding element.||abc? matches “abc” and “ab”|
|+||One or more occurrences of the preceding element.||ab+cd matches “abcd”, “abbcd”, “abbbcd”, and so on, but not “acd”.|
The important thing to note here is that Rank Math supports Regex right out of the box. However, we highly advise you to proceed with caution especially if you are inexperienced with regular expressions and changes that can break your site. So before making changes, the very least you could do is test a pattern and finetune it to ensure it matches only what you want it to using Regex101.
A great use-case of a Regex redirect is when you used AMP on your site previously but want to disable it. When doing this you’ll need to redirect all AMP URLs back to the original, normal URLs. This can easily be done with regular expressions adding the following as source & destination URLs in Rank Math:
Regex Source URL: /(.*)/amp Destination URL: /$1
Method #2 – Alternative, Single-Use Third-Party Plugins
Now, if you don’t wish to use Rank Math’s Built-in Redirections Manager – there are of course a whole range of single-use plugins (i.e. ones focused on only a single feature) that are alternatives that we can recommend.
Here are some alternative redirection plugins worth checking out:
All of the above plugins make it incredibly easy to create 301 redirects similar to how Rank Math’s built-in Redirections module works:
And, the Redirections plugin (which is free) in particular also has the ability to import & export your redirects to create bulk 301 redirects – as shown below:
Method #3 – Creating 301 Redirects in Bulk By Editing Your .htaccess File
A .htaccess file is a file that sits in the root directory of a website that controls Apache (a web server stack) which your web host may use – allowing you to easily enable or disable certain functionality, including creating redirects. For this method to work, you will need to be able to make changes to your website’s .htaccess file and your web host’s server configuration must support the use of .htaccess configuration files.
Here’s what the code to add a .htaccess redirect looks like:
“redirect 301 /old https://rankmath.com/new”
The beginning “redirect 301” simply indicates to Apache that the information that follows is a redirect (in particular a 301 redirect) to forward one URL to another. And, in the case above “/old” is the original location (i.e. redirect source) of the page. And the “https://rankmath.com/new” URL is the destination for this redirect.
Please note: this part of the code requires the full URL to be entered in its entirety including “http://” or “https://”, for a .htaccess server-level redirect.
If you already use WordPress, of course, Rank Math makes this very easy as it even offers the ability to sync redirects to your .htaccess file so that they’re performed on the server level.
But, even if your website isn’t powered by WordPress, you can still benefit from using Rank Math to manage your redirects since all redirects created can easily be exported to .htaccess files or NGINX config files.
Meaning that you can create and modify redirects in bulk using Rank Math’s Export to CSV option and then re-import the redirects into a WordPress installation so that you can export them to a .htaccess file and add the redirect rules directly to your website’s .htaccess file.
Note: Redirectly is a useful tool that helps take the guesswork out of generating more complicated redirect rules.
Method #4 – Creating 301 Redirects in Bulk By Editing Your NGINX .conf File
Depending on your web hosting environment, you may not be able to create 301 redirects by editing your .htaccess file – in which case, an alternative would be to use the NGINX config (.conf) file to do so instead…
Similar to how the .htaccess file functions, you can create a 301 permanent redirect in NGINX by adding the following line:
“rewrite ^/old$ https://rankmath.com/new permanent;”
The “rewrite” matches regular expression patterns in parenthesis.
The “/old” provides the original location of the page
The “https://rankmath.com/new” is the new URL of the page and is where the server should redirect visitors to.
The “permanent” tells NGINX that this is a permanent redirect so it’ll use the 301 (moved permanently) response code.
Once complete, you will need to restart/reload NGINX for newly created redirects to start working as expected. As mentioned above, for .htaccess files – even if your website isn’t powered by WordPress – you can still manage your redirects with Rank Math as all redirects created can easily be exported to .htaccess files or, in this case, NGINX config files.
Meaning that all you need to do is:
- Export the CSV redirects using Rank Math
- Modify the file to create, edit and delete redirects as you see fit
- Re-import the CSV using Rank Math
- Export your redirects to your NGINX config file
- Add the rules to your server (specifically to this web applications) NGINX .conf file.
- Restart NGINX to ensure that the changes made take effect.
5. After Action Report – Test Your Redirects
Now that you know exactly how to set up & deploy 301 redirects in bulk – it’s important to note that you should thoroughly test your redirects as you implement them – especially if you used one of the advanced implementations or chose to use regular expressions. Test edge cases, variations of your domain (i.e. www and non-www) to ensure that the redirects do in fact work as intended.
A great simple tool for this which makes it super simple to bulk test URL HTTP status codes, response headers, and redirect chains is HTTPstatus.io.