Let’s admit it – nobody likes broken links. This is why extra caution is needed when setting up 301 redirects. Whether you’re working on a complete website redesign or doing simple changes in the permalink structure, you are likely to change multiple URLs at once.
And that means setting up 301 redirects in bulk is needed too. Formatting and mapping the old permalinks to new ones is pretty simple. The process’s longest part is coming up with the new URLs and writing them down. So, follow the steps outlined below to avoid any risk of negatively impacting both user experience and efforts put into the Search Engine Optimisation.
Setting up 301 redirects in a bulk
For this tutorial, we will presume that redirection is needed for WordPress-based websites. In that case, there are two ways of setting up 301 redirects:
- Using third-party plugins
- Editing the htaccess file
Using WP plugins like Redirection or Pretty Links makes redirection easy and less technical. However, redirects are not as efficient and are generally “slower” than the ones done directly on the server side.
When adding redirects in the .htaccess file, you ensure that they’re processed before anything else in WordPress. So this is how to do it:
Step 1 – Locate the htaccess file and map the permalinks
The .htaccess file is located in the root directory of your WordPress site.
If you don’t see it, make sure to enable the option for displaying hidden files in Settings > Show hidden files.
We recommend creating a backup of the file first, just in case. Download the file to your PC and make a list of all pages you want to redirect to new URLs.
To set up a 301 redirect, you need both new and old URL locations, and the formatting should look like this:
Redirect 301 “old-url” “new-url”
So, create an Excel sheet containing two columns: the first one has all the “old” URLs, while the second has the belonging “new” URLs.
Make sure to use the full URLs, as seen in the example below:
Step 2 – Formatting the Excel file
Next up – editing the first column. So, select the “Old Permalink” column, and replace the domain name, so that only the second part of the permalink remains.
For example, the first permalink https://www.serprise.agency/blog-1 needs to be replaced with /blog-1.
But to speed things up, we can immediately replace that domain name with the text “redirect 301”, like this:
Simply use the CTRL+H shortcut on the keyboard to find and replace the text, or use the FIND AND SELECT function from the toolbar.
Step 3 – Final touches in Word
Now select both columns, then copy and paste them into the Word document. Copied data will be recognized as a table, so you need to convert it to text:
Select the table, and then click on the “Convert to text” function, located in the LAYOUT tab. When asked about the separator, simply use a single space:
Step 4 – Editing the htaccess file
All that’s left is adding the data into the .htaccess file. Open the downloaded file in a text editor like Notepad or Sublime Text, and paste the data below the “RewriteEngine On” line.
Save the edited file, upload it to your server via cPanel, and you’re all done!
Testing the results
The final thing to do is check if the redirects actually work. One way to do it is by manually typing the old permalink address, and seeing if you land on the new permalink address.
But a faster way is by using an online tool like httpstatus.io and pasting all the old permalinks there. They should have a status code 301, indicating that the page was permanently moved to another address.