WordPress websites are great for scaling businesses. They’re flexible, highly customizable, codeless (if you prefer), and you can install plugins for just about anything you want to get done.
As your site scales, redirects become an inevitability. You’ll eventually need to start implementing them to ensure that visitors and search engines are routed to the pages they’re looking for and away from an error page. It’s best to learn how they work now than scramble to fix a broken link down the road.
Fortunately, creating redirects in WordPress is straightforward as long as you know what you’re doing. In this guide, you’ll learn what redirects are, how they support a good user experience and SEO strategy, when and why you’ll need to add them, and two methods to create redirects in WordPress.
What is a WordPress redirect?
In WordPress, a redirect occurs when the URL of a web page is mapped to a different URL. When a user tries to visit the web page at the first URL, they will be automatically sent to the page at the new URL.
There are several types of redirects, but, unless you’re a web developer, you only really need to know about two: 301 (permanent) redirects and 302 (temporary) redirects.
A 301 redirect is the one you’ll probably be using most. This redirect is permanent, meaning that a web page has been moved to a new location and you don’t plan to move it back to the original location. 301 redirects are also the best option to preserve search engine authority, which we’ll discuss later on.
A 302 redirect indicates that the new URL is temporary, and that you do plan to move the web page back to its original location at some point. A 302 redirect may be used for updating or repairing web pages — for example, sending users to an alternative page while you fix a broken page — but it’s far less common than a 301 redirect.
Since you’ll usually be dealing with 301 redirects as a WordPress admin, we’ll be discussing those in this post. 301 redirects in WordPress are easy to set up with plugins or with a bit of code. But first, it’s important to know when to use them and why they’re necessary.
When to Use Redirects in WordPress
Generally, you should use a 301 redirect whenever you’re moving a web page on your site from one URL to another URL and want to send any web traffic from the old URL to the new URL. If you don’t set up a redirect, users will receive a 404 (not found) error when visiting the old URL.
Here are some cases that would call for a permanent redirect:
- Replacing an outdated page: If you’ve added a new page to your website that serves more up-to-date content than another page, you can redirect the old page URL to the new one.
- Removing a page from your site: If you plan to remove a page from your site, remember that URLs don’t just go away — search engines and some visitors will have saved the link to this removed page. To prevent a 404, redirect the URL of the removed page to a similar page, the home page, or a page that tells users the product or content is no longer available.
- Changing your website structure: Reorganizing your website’s structure involves moving pages around, and this likely calls for one or more redirects to ensure visitors are sent to the right pages.
- Changing permalinks: You may want to change your permalink structure so your URLs look more professional, are easier to read, and help your SEO. In this case, redirect your old URLs to your new, updated URLs to prevent broken links.
- Changing a domain name: If you get a new domain name, this will be reflected in your URL. Old URLs should be redirected to URLs containing your new domain name.
- Routing multiple domains to one page: To capture wayward traffic, website owners may purchase domain names that are similar to their primary domain name. This way, if a visitor types in the wrong domain, they’ll be redirected to the right website. This also keeps competitors from buying up similar domains and stealing traffic.
- Saving an email campaign: Say you’ve sent out an email blast that contains a broken link … oops. While you can’t change the link in the email, you can redirect the broken URL to the correct URL. Crisis averted.
How to Launch a WordPress Website
Learn how to launch a website on WordPress with this step-by-step guide and checklist. Learn how to...
- Set up your domain name.
- Install an SSL certificate.
- Analyze your content.
- Back up your site.
Download Free
All fields are required.
Why You Should Use Redirects in WordPress
Why bother going through the work to set up a redirect instead of just doing nothing? There are two reasons: user experience and SEO.
User Experience
The most obvious reason to implement redirects is to prevent broken links to your website. These result in 404 errors, which result in a poor user experience. You’ve probably had this happen to you — clicking a backlink or an old bookmark and being brought to an error page. Annoying, right? 301 redirects keep this from happening.
If visitors do happen to find a broken URL, you can improve things a bit by creating a customized 404 page that entertains (and maybe even converts) visitors, like this one:
This should only be a last resort as it’s still a poor user experience. Ideally, visitors should never have to reach this page. Why bother searching your site for the content they want when they could just as easily head to a competitor’s?
With a redirect, you can be sure that users will always go to the right place, even after you’ve moved, deleted, or otherwise changed a page.
SEO
The more insidious consequences of 404s are their effects on your WordPress SEO. After all, it’s not just human visitors accessing your website. Search engine crawlers are regularly pinging your website to index your content and site structure.
If one of these bots finds a 404, it will dock points from your site’s authority — search engines don’t want to recommend websites that appear broken or missing important resources. And, again, a clever 404 page won’t save you here.
By properly implementing a 301 redirect, search engines will know that your page was permanently moved or removed, and you’ll send bots to the correct page to avoid the broken link. As a result, your new URL will be properly indexed by these bots.
Additionally, another key benefit of permanent redirects is that they preserve the search ranking of the old URL. For instance, if you own a landing page with high authority and change its URL, the new URL will retain the authority of the old URL. The ranking of your landing page should not be affected significantly if at all.
Now that we know when and why to use redirects in WordPress, let’s learn how: First, we’ll discuss the plugin method, then an alternative manual method.
How to Redirect a URL in WordPress With a Plugin
A plugin is the simplest way to implement and monitor your WordPress website redirects, especially if you refrain from modifying WordPress files yourself.
There are many WordPress redirect plugins that all work similarly, allowing you to create basic 301 redirects as well as more complex site-wide redirects. Some also track redirects to tell you how many hits each one is getting and alert you of any problems.
Here, we’ll be covering how to set up 301 redirects with two popular plugins, Redirection and All in One SEO.
Redirection
Redirection is one of the most popular redirection plugins available, with over 2 million downloads. This plugin is simple to use, reliable, well-maintained, and completely free. To create a 301 redirect with Redirection:
1.Install and activate the Redirection plugin.
2. In your dashboard, select Tools > Redirection.
3. On the welcome screen, click Start Setup.
4. On the next screen, you can choose to allow Redirection to create automatic redirects when you change permalinks. You can also choose whether you’d like the plugin to log 404 errors and redirects on your site. Choose your preferences, then click Continue Setup.
5. Next, Redirection will test its connection with the WordPress REST API. Once this test is successful, you can click Finish Setup, then Finished!
6. You’ll be brought to the main Redirection page (Tools > Redirection) in your dashboard. Here, you can view all current redirects, as well as a log of redirect activity and 404 errors.
7. To add a new redirect, first paste the URL you want to redirect from into the Source URL field.
8. Paste the URL you want to redirect to into the Target URL field.
9. By default, this will create a 301 redirect. To create a different redirect or to toggle advanced settings, click the cog icon. You can give your redirection a title, matching criteria for the redirect, and/or an action when a match is found.
10. When finished, click Add Redirect. You’ll see your new redirect added to the list. To test your redirect, click Check Redirect and see that you’re routed to the target URL. If you have logging turned on, you’ll see this activity by clicking Log above.
All in one SEO
All in One SEO (AIOSEO) is another popular, powerful plugin to help you improve your search ranking. The Pro and Elite versions of the AIOSEO include a redirection manager that finds broken links and sets 301 redirects for them. You can also create redirects yourself through the plugin.
To create a 301 redirect with AIOSEO:
1. Install, activate, and set up the AIOSEO plugin.
2. In your dashboard, select All in One SEO > Redirects. You’ll be taken to the Redirects tab.
3. Paste the URL you want to redirect from into the Source URL field. Leave your domain name and everything before it out of the URL. For example, if your source URL is “https://www.example.com/old-page/”, only paste “/old-page/”. Into the field
4. Paste the URL you want to redirect to into the Target URL field. This URL can be a relative URL or an absolute (i.e., complete) URL.
5. In the Redirect Type dropdown, choose 301 Moved Permanently.
6. Click Add Redirect.
7. You’ll see your new redirect added to your redirects list. Here, you can deactivate your redirect. To test your redirect, click Check Redirect and see that you’re routed to the target URL.
How to Manually Redirect a URL in WordPress
If you’re comfortable editing server files directly, it’s also possible to set up redirects manually.
For this method, we’ll be modifying .htaccess, a configuration file found on most WordPress websites. Use caution when editing this file, since even small typos could break your website. We recommend making a backup of your current site before going forward, just in case something goes wrong.
How to Launch a WordPress Website
Learn how to launch a website on WordPress with this step-by-step guide and checklist. Learn how to...
- Set up your domain name.
- Install an SSL certificate.
- Analyze your content.
- Back up your site.
Download Free
All fields are required.
Also, make sure you’re allowed to modify your server files directly — check your hosting provider’s documentation or contact support to find out how you should handle redirects.
To create a permanent redirect in .htaccess:
1. Go to your server filesystem. There are multiple ways to do this:
- through your hosting account’s control panel, like cPanel
- through an FTP client
- through the WordPress file editor
2. Locate your .htaccess file, which is located in your site’s root directory by default. If you don’t see it, find the option to show hidden files and turn it on.
3. Open .htaccess in a text editor (depending on what tool you’re using, you may need to download the file to your computer).
4. To permanently redirect a single page, paste the following code at the end of your .htaccess file:
# 301 redirect - single page
Redirect 301 /old-page
https://www.example.com/new-page/
… where /old-page is the relative URL of the original page and https://www.example.com/new-page/ is the absolute URL of the target page.
5. To permanently redirect an entire site to another domain, paste the following code at the end of your .htaccess file:
# 301 redirect - site-wide
Redirect 301 / https://example.com/
… where https://example.com/ is the new website’s URL.
6. Save the file and re-upload the file to your server if necessary.
7. Test the redirect by visiting the old URL and checking that you’re sent to the new URL.
Send your users to the right place.
Redirects are one of those tools that all website owners should know how to use. At some point, you’ll come across an instance when you’ll need to scrap one URL for another. However, URLs don’t just disappear, which is why redirects are so important for keeping your WordPress website healthy.
You’ve already done a lot to build authority in your space — don’t let broken links undo all of that work. Redirects are quick and simple, and they preserve your standing with visitors and search engines alike.