How to Create 301 Redirects in WordPress (2023 Beginners Guide)
Do you need to set up 301 redirects on your WordPress website? Want to ensure visitors and search engines are directed to the right page when you change a post URL or move your site to a new domain?
301 redirects are an essential tool that every WordPress user should know. When set up properly, they seamlessly forward both users and SEO rankings from an old URL to a new one. No more "page not found" errors or frustrated visitors.
In this comprehensive guide, we‘ll cover everything beginners need to know about 301 redirects – what they are, why they‘re critical, and step-by-step tutorials for creating them in WordPress.
Whether you‘re a blogger, small business owner, or website developer, you‘ll learn how to master WordPress redirects by the end of this post. Let‘s dive in!
What Is a 301 Redirect?
A 301 redirect is a permanent redirect from one URL to another. It‘s a way of telling browsers and search engines that a page has permanently moved to a new location.
301 refers to the HTTP status code for this type of redirect. When a browser or search bot hits a 301 redirect, it‘s automatically forwarded to the new URL.
After a 301 redirect is set up, any visitors, link equity, and page authority from the old URL transfers to the new one. The old URL essentially becomes an alias that points to the new, canonical (preferred) URL.
Why Are 301 Redirects Important?
301 redirects are a crucial tool for maintaining a site‘s SEO, usability, and traffic when URLs change. Here are some of the key reasons to use them:
Forwards SEO rankings – When you 301 redirect an old URL to a new one, search engines transfer between 90-99% of the link equity and ranking power to the new address. 301s tell Google that you‘ve permanently moved a page and prevent a loss of SEO.
Prevents 404 errors – If you don‘t redirect old URLs that change, visitors will hit a 404 "page not found" error. This leads to a poor user experience and loss of traffic. With a 301, users will automatically reach the correct page.
Combines link authority – If you have multiple pages with similar content, you can 301 redirect them to a single canonical URL. This combines all the link authority into that one preferred page to boost its rankings.
Maintains bookmarks and links – Any bookmarks or links to an old URL will continue working with a 301 redirect in place. You won‘t lose visitors coming from old links.
Migrates a site to a new domain – If you rebrand or change your domain name, 301 redirects are crucial to maintain your traffic and SEO. You can redirect every page on the old domain to the equivalent page on the new domain.
In short, 301 redirects are a best practice for retaining traffic and SEO whenever a URL changes or a page moves in WordPress. Next, let‘s look at when you should use them.
When to Use 301 Redirects in WordPress
Here are some common scenarios when you‘ll want to set up 301 redirects in WordPress:
Changing a post or page URL – If you update the permalink of a published post or page, set up a 301 redirect from the old URL to the new URL. This is important for keeping the page‘s SEO authority.
Fixing 404 error pages – Use your Google Search Console report to find any broken links resulting in 404 errors. Then redirect those old URLs to relevant, live pages to recapture the traffic and link authority.
Deleting a post or page – If you delete content, redirect its URL to a relevant live page, so visitors don‘t hit a 404. You may redirect to a category page or a related post.
Moving your site to a new domain – Website rebrands or domain changes require 301 redirecting every page on your old domain to the equivalent page on the new domain. This maintains your SEO and prevents visitors from landing on a different site.
Merging websites – If you consolidate multiple websites or blogs into one, set up 301 redirects from the old pages to relevant pages on the new site.
Fixing typos in URLs – If you accidentally publish a page with a typo in the URL, change it to the correct spelling and redirect the wrong URL to the right one.
Linking to a new product page – If you discontinue a product and replace it with a new one, redirect the old product page to the new version to keep customers on your site.
Changing to HTTPS – After migrating your WordPress site from HTTP to HTTPS, you should redirect all HTTP traffic to the secure HTTPS versions of your pages to avoid SEO issues.
Now that you know when to use 301 redirects in WordPress, let‘s dive into how to actually create them. We‘ll cover two methods – using a WordPress redirect plugin and manually editing your .htaccess file.
How to Set Up 301 Redirects in WordPress Using a Plugin
The easiest way for beginners to create 301 redirects is by using a WordPress plugin. There are several great options available. For this tutorial, we‘ll use the free Redirection plugin.
Step 1: Install and Activate Redirection Plugin
First, you need to install and activate the free Redirection plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, go to Tools » Redirection to configure the plugin.
Step 2: Set Up Redirects
Under the Redirects tab, enter the old URL you want to redirect in the Source URL field.
Then, enter the new destination URL in the Target URL field.
Make sure to choose "Redirections" as the Group, which defaults to 301 redirects. You can also click the gear icon to reveal more options.
Finally, click the "Add Redirect" button to make it live.
Repeat this process to create additional 301 redirects for any other changed URLs on your site.
Step 3: Check Redirects
After setting up redirects, it‘s important to test them to make sure they‘re working.
Go to the old URL in your browser (or click the link under Redirects) and make sure it forwards to the correct new page. You can also use an online redirect checker tool.
If it doesn‘t work, go back and double check that the Source URL and Target URL are correct.
In the Redirection plugin, you can also view all your existing redirects in the Redirects table. You‘ll see the old URL, new URL, and the number of times the redirect has been used under Hits.
Redirection will also log any new 404 errors it finds on your site under the 404 Logs tab. You can redirect these broken URLs by clicking the Add Redirect button next to them.
In the plugin settings, you have options to auto-generate a URL when you change a post permalink, monitor permalink changes, keep logs, and more.
Other WordPress Redirect Plugins
In addition to Redirection, there are some other WordPress plugins you can use to set up 301 redirects. Here are a few other popular options:
All In One SEO – Comes with a built-in redirects manager. An easy way to create redirects through a visual interface.
Simple 301 Redirects – A lightweight plugin dedicated to only 301 redirects. Great for beginners.
Pretty Links – Set up redirects using pretty, custom URLs. Track clicks, automate links, and manage affiliate links.
How to Create 301 Redirects by Editing .htaccess File
In addition to using a plugin, you can also set up 301 redirects in WordPress by directly editing your .htaccess file. This is the manual method and requires adding rewrite rules to your server configuration file.
The .htaccess file contains directives that tell the server how to behave in certain scenarios. It‘s a server configuration file used by Apache web servers.
Here are the steps to manually create a 301 redirect in your .htaccess file:
Step 1: Access .htaccess File
Access your website files via FTP or through your hosting control panel file manager. The .htaccess file is located in the same directory as your wp-config.php file.
It‘s a hidden file, so you may have to force show hidden files in your FTP client or file manager to reveal it.
Step 2: Back Up Your .htaccess File
Before making any changes, it‘s critical you create a backup of your existing .htaccess file. Download a copy to your computer or make a duplicate file in case anything goes wrong. Even a small syntax error can break your site.
Step 3: Add Redirect Code
Edit the .htaccess file and place the 301 redirect code at the bottom after the # END WordPress line.
Here is the basic format for a 301 redirect in .htaccess:
Redirect 301 /old-post/ http://www.example.com/new-post/
To redirect an old post to a new post, replace /old-post/ with the URL slug of the page you are redirecting. Then replace http://www.example.com/new-post/ with the full new destination URL.
Make sure to include the trailing slash / after your old and new URL slugs. Leave a space between the 301 and the old URL.
You can repeat this process to add additional redirect rules for each URL you need forwarded.
Here‘s an example of what multiple 301 redirects would look like in your .htaccess file:
Redirect 301 /10-best-recipes/ http://www.example.com/recipes/
Redirect 301 /christmas-cookies/ http://www.example.com/recipes/christmas-cookies/
Redirect 301 /apple-pie/ http://www.example.com/recipes/pies/apple-pie/
Save your changes and re-upload the .htaccess file when finished. Make sure your redirects are working by visiting the old URLs and checking that they forward correctly.
Here are some other common .htaccess redirect rules you may need:
Redirect an entire domain:
Redirect 301 / http://www.newdomain.com/
Redirect a file extension:
RedirectMatch 301 (.*).jpeg$ $1.jpg
Redirect from www to non-www URLs:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
While .htaccess is a powerful tool for creating redirects on Apache servers, it can be dangerous in untrained hands. One mistake can cause a server error that crashes your site.
So if you‘re a beginner, using a WordPress redirect plugin is the safer and easier way to set up 301 redirects.
Other Types of Redirects
While 301 redirects are the most common and useful for SEO, there are other types of redirects you might need to be familiar with.
302 Redirect – A temporary redirect. It tells search engines the page has only moved briefly, so it does not pass link equity the same way a 301 does. Avoid using 302s unless content has only temporarily moved.
307 Redirect – The successor to the 302 redirect. It‘s also used for temporary redirects, but it retains the same method and body as the original request, unlike a 302.
Meta Refresh – A type of redirect executed on the page level rather than the server level. It‘s slower and not a best practice for SEO. Stick to 301 server-side redirects for better performance.
Best Practices for Managing Redirects
Here are some tips and best practices to keep in mind when creating 301 redirects in WordPress:
Redirect old pages to the most relevant new page. If an exact match isn‘t available, choose the closest related page. Irrelevant redirects can hurt the user experience.
Use absolute paths. While relative paths may work, using complete destination URLs is the most foolproof method for redirects, especially when changing domains.
Only redirect as needed. If a URL never existed, a redirect isn‘t necessary. Too many redirects can slow down your site and dilute SEO authority.
Avoid redirect chains. An old URL should be redirected directly to the final destination URL, not to a URL that is already being redirected somewhere else.
Prioritize high-traffic pages. Focus on redirecting your important pages that get the most visits, backlinks, and SEO value.
Don‘t forget images. If you migrate your site to a new domain, you‘ll also need to create redirects for any images on the old domain.
Keep track of redirects. Make a list of all the redirects you create so you can refer back to them later if needed. Some WordPress plugins also track redirects for you.
Test redirects. After setting up redirects, click on the old URLs to make sure they‘re forwarding visitors to the correct pages.
Frequently Asked Questions About 301 Redirects
Got more questions about using 301 redirects in WordPress? Here are some common ones we hear from beginners.
Are 301 redirects bad for SEO?
No. When set up correctly, 301 redirects prevent the loss of search engine rankings when a page URL changes. They tell Google that a page has permanently moved so it can transfer the authority to the new destination.
Do 301 redirects count as backlinks?
Yes. A 301 redirect counts as a link from the old URL to the new one. The new page essentially "inherits" the PageRank and authority of the original page.
Do 301 redirects lose pagerank?
Google has stated that a small amount of pagerank is lost through a 301 redirect (around 10-15%). But in most cases, the benefits of using a 301 to preserve traffic and existing backlinks far outweigh any minimal loss in pagerank.
How long do 301 redirects last?
A 301 redirect is permanent, so it will last indefinitely until you remove it. However, it‘s a best practice to only keep redirects as long as they are needed. If an old URL no longer has any inbound links or traffic, the redirect can be deleted.
How fast are 301 redirects?
301 server-side redirects happen almost instantaneously, in a matter of milliseconds. If a 301 redirect is significantly slowing down your page load time, there‘s likely another underlying issue that needs to be investigated.
Can you have too many 301 redirects?
Yes, while there‘s no set limit, having excessive 301 redirects can slow down your site. Only set up necessary redirects, and remember that redirect rules are executed in a loop until there are no more matches. Try to minimize the number of redirects a URL has to go through.
Do the 301 redirects affect Google Search Console?
When you move pages and set up 301 redirects, you should make sure to use the Change of Address tool in your Google Search Console account. This notifies Google of the change and updates your search console reports to reflect the new site structure.
Start Using 301 Redirects on Your WordPress Website
Redirects are a vital part of maintaining a WordPress site. They‘re key to preventing 404 errors and preserving your organic search traffic. Now that you‘ve learned how to create 301 redirects in WordPress, you have the power to manage URL changes and site moves like a pro.
Remember, 301 redirects aren‘t something you should ignore or put off. Failing to use them for changed URLs can result in frustrated users and lost SEO. Make them a priority when updating content, redesigning your site navigation, or migrating to a new domain.
For most WordPress beginners, using a redirect plugin will be the safest and easiest solution. But if you want a challenge, you can also learn to create redirects by directly editing your .htaccess file.
Either way, test your redirects to make sure they‘re working as intended. Monitor broken links in Google Search Console, and keep a list of your redirects for future reference.
Master the art of the 301 redirect, and you‘ll be able to fearlessly modify your WordPress URLs and site structure as needed. Happy redirecting!
