Blogging

How to Setup Bulk 301 Redirects in WordPress (The Best Way)

Sponsored Links

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.

1. What Is A 301 Redirect? 

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.

» MORE:  6 Blogging Trends to Capitalize on This Year

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:

  • Geotargeting
  • 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.

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:

  1. Download Rank Math
  2. Follow Rank Math’s Setup Guide
  3. And that’s it! Keep reading…

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.

Enable Redirections

[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:

Rank Math Redirections

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.

Redirect Options

And once ready to activate, simply click Add Redirection.

Learn more about creating redirects in our documentation or in our detailed video tutorial below:

» MORE:  How To Integrate Blogger Blog With Ezoic (Expert Tips)

[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

Add Redirects In Bulk

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:

  1. 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:
  2. 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.
  3. 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.
  4. 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.

Character Interpretation Example
* 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.

» MORE:  Top 4 Best Ways To Increase Low AdSense CPC (Experts Method)

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:

  1. Redirection
  2. 301 Redirects
  3. PrettyLinks
  4. Safe Redirect Manager

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:

  1. Export the CSV redirects using Rank Math
  2. Modify the file to create, edit and delete redirects as you see fit
  3. Re-import the CSV using Rank Math
  4. Export your redirects to your NGINX config file
  5. Add the rules to your server (specifically to this web applications) NGINX .conf file.
  6. 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.

Credit: Rankmath

Sponsored Links

52 Comments

  1. I am really inspired along with your writing skills аs well as with the structure fߋr your weblog. Is that this a paid topic օr dіd you customize it yourself?
    Anyway kеep ᥙp the nice high quality writing, it is uncommon to peer а nice weblog like this օne today.

  2. Pleasе let mе know if you’re lօoking f᧐r a article author for your site. You have some really ցood posts and Ι think I would bе a good asset. Іf you evеr want tߋ take sоme of the load off, Ӏ’d гeally like to wrіte some articles f᧐r youг blog іn exchange fоr a link back to mіne. Please blast me an email іf intеrested.
    Тhank you!

  3. Hello! Would you mind if I share your blog with my zynga group?
    There’s a lot of folks that I think would really appreciate your content. Please let me know. Thanks

  4. I don’t know if it’s just me or if perhaps everybody else encountering problems with your site.

    It appears as though some of the text within your content are running off the screen. Can someone else please provide feedback and let me know if this is happening to them as well? This could be a problem with my web browser because I’ve had this happen previously. Thanks

  5. Hey! I could have sworn I’ve been to this website before but after browsing through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely delighted I found it and I’ll be bookmarking and checking back frequently!

  6. Your style is very unique compared to other folks I’ve read stuff from. Many thanks for posting when you have the opportunity, Guess I will just bookmark this blog.

  7. Thank you for the good writeup. It in fact was a amusement account it.

    Look advanced to more added agreeable from you! By the way, how can we communicate?

  8. Woah! I’m really loving the template/theme of this site. It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance” between superb usability and visual appeal.

    I must say you’ve done a awesome job with this. Additionally, the blog loads extremely fast for me on Firefox. Excellent Blog!

  9. Hey would you mind letting me know which webhost you’re working with?
    I’ve loaded your blog in 3 different browsers and I must say this blog loads a lot faster then most. Can you suggest a good hosting provider at a fair price? Many thanks, I appreciate it!

  10. Asking questions are truly fastidious thing if you are not understanding anything totally, except this paragraph provides good understanding even.

  11. I’m not that much of a internet reader to be honest but your site’s really nice, keep it up! I’ll go ahead and bookmark your website to come back down the road. Many thanks.

  12. I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a developer to create your theme? Outstanding work!

  13. Ι got this site from my friend who tоld me concerning this web page аnd now this timе I am browsing this site аnd reading very informative articles or reviews at thiѕ place.

  14. Hi! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly?
    My weblog looks weird when viewing from my iphone 4. I’m trying to find a theme or plugin that might be able to correct this problem. If you have any suggestions, please share. Many thanks!

  15. May Ι simply say what a comfort to uncover an individual wh᧐ аctually knows what they are discussing online.

    You ceгtainly undertand how to bring an issue to light and makе it imρortant. More people must rеad this and understand this side օf уour story. I can’t believe yоu aren’t more popular ցiven that you certainly possess the gift.

  16. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

  17. We’re a bunch of volunteers and starting a new scheme in our community.
    Your website provided us with useful info to work on. You’ve performed an impressive task and our entire neighborhood might be grateful to you.

  18. hello!, I love your writing ting very so much! shall we bе in contact morе about your article on AOL? I need an expert on this aгea to resolve my problem. Maybe that is үou! Having a look ahead to look you.

  19. hello!, I like your writing so much! share we be in contact more approximately your article on AOL?
    I need a specialist in this area to solve my problem. May be that is you! Looking ahead to look you.

Leave a comment

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

Back to top button

You cannot copy content of this page