Struggling with how to add 301 redirects to WordPress? These nifty redirects are an SEO friendly approach that let you re-route traffic to your site in a number of helpful ways. But they’re also confusing for many casual WordPress users.
So, to help you out, I’m going to use this post to dig into 301 redirects as they apply to your WordPress site.
I’ll start with a basic discussion of what 301 redirects are and when you’d want to add 301 redirects to WordPress. Then, I’ll show you how to get them set up using either a free plugin or your .htaccess file.
If you’re already familiar with the basics, you can click the button below to jump straight to the tutorials:
Go Straight to Tutorials
Otherwise, let’s get started!
What Does a 301 Redirect Do?
In general, redirects are a way for you to automatically send visitors who land on Page A straight to Page B. Essentially, you use a redirect to automatically reroute traffic if you ever need to move a page (or pages).
There are different types of redirects you can implement on your site, usually marked by a certain number. Without getting too technical, these numbers essentially refer to whether or not the page has moved permanently or temporarily.
301 redirects deal with permanent moves.
That is, a 301 redirect tells web browsers and search engines, “hey, this page has permanently moved to a new location. So treat it exactly the same as the old page”
The main benefit of this permanent approach deals with SEO. According to Moz, a 301 redirect “passes between 90-99% of link juice (ranking power) to the redirected page.”
Basically, if you want to redirect human traffic and have your new page to maintain the same Google rankings as the old page, a 301 redirect is usually your best bet.
You Can Redirect More Than a Single Page
One neat thing about 301 redirects is that you aren’t forced to use 301 redirects on a 1:1 one basis.
You can redirect multiple pages to one new page, or automatically redirect all pages that meet certain criteria to their respective new version.
I’ll cover these more advanced types of 301 redirects in more detail below.
Some Examples of When WordPress Users Need 301 Redirects
Now, I want to get a little bit more specific and actually give you some examples of when you’d want to use a 301 redirect on your WordPress site.
- Changing your permalink or slug structure. If you do so, you’d want to redirect URLs using your old permalink or slug structure to your new one.
- Changing the URL of a single post or page. WordPress should automatically redirect the old post’s URL to the new one, but I still recommend manually setting up a 301 redirect because the process doesn’t always work.
- Consolidating multiple posts into one. Some SEO experts recommend consolidating multiple small posts into one monster post. If you do that, you’ll want to 301 redirect all those small posts to the big one.
- Moving to HTTPS/SSL on your site. If you add SSL to your WordPress site, you need to make sure to add a 301 redirect to send all unsecured traffic to the SSL version of your site.
- Changing your domain name. If you completely change your domain name, it’s essential that you use 301 redirects to redirect traffic from your old domain to your new domain name.
Below, I’ll show you two methods to add 301 redirects to WordPress to handle these various situations.
How to Add 301 Redirects to WordPress With Simple 301 Redirects
For most minor 301 redirects, you can use a free plugin called Simple 301 Redirects. While you can manually use .htaccess for everything (the next method that I’ll show you), I like this plugin because:
- You can quickly create 301 redirects without leaving your WordPress dashboard
- It makes it much easier to manage your existing 301 redirects
- It’s just plain easier for beginners than digging around the .htaccess file
To get started, install and activate the plugin. Once it’s activated, you can head to Settings → 301 Redirects to start setting up some 301 redirects:
Redirecting a Single Page to Another Page
Let’s start with the easiest example – redirecting a single post or page to another single post or page.
Let’s say you want to redirect:
yourdomain.com/old-page
To
yourdomain.com/new-page
All you need to do is grab the URL of each page relative to your site’s root domain. Most of the time, that means you just want to take the portion of the URL that comes after “.com” (or whatever your domain name ends with).
For our example, that means you would configure the plugin like this:
- Request: /old-page
- Destination: /new-page
While you can use the full URL, using only the portion relative to the root is a cleaner way to do it.
Then, click Save Changes.
And that’s all there is to it! Anyone who visits the old URL will be automatically redirected to the new URL.
Using Wildcards For More Complex 301 Redirects
Wildcards are a slightly more advanced feature that let you dynamically redirect multiple pages to one or more associated pages.
For example, let’s say you have an entire category of posts like:
yourdomain.com/travel/POST-SLUG
You have 10 posts in the travel category, all using that same URL category slug.
Now, let’s say you want to change the category slug to “adventure”. So you want all of those 10 posts to have the new URL of:
yourdomain.com/adventure/POST-SLUG
Rather than going through the tedious process of manually redirecting every single post, you can use wildcards to automatically handle the process for you.
Basically, a wildcard, represented by an asterisk *, is “any dynamic value entered in that part of the URL structure”.
Let me go back to the example to show you how it works.
If you configure Simple 301 Redirects like this:
- Request: /travel/*
- Destination: /adventure/*
- Check the Use Wildcards? box
That configuration means that:
- yourdomain.com/travel/vietnam gets redirected to yourdomain.com/adventure/vietnam
- yourdomain.com/travel/thailand gets redirected to yourdomain.com/adventure/thailand
- Etc.
You can even get more creative with wildcard redirects if you want. Here are some examples from the plugin’s documentation:
How to Add 301 Redirects to WordPress via .htaccess
If you need to set up broader redirects – like to redirect an entire domain to another domain or redirect traffic to SSL, you can also implement 301 redirects via your .htaccess file.
While it’s possible to add basic 301 redirects to your .htaccess file, as well, if you’re just redirecting content within your existing WordPress site, I think it’s easier to use Simple 301 Redirects.
To add 301 redirects to your WordPress site, you’ll need to connect to the root folder of your WordPress site via either FTP or cPanel’s File Manager tool.
Then, look for the .htaccess file:
Before you make any changes to your site, it’s important to back up your existing .htaccess file. Even small mistakes can tank your site – so you definitely want a recent backup handy in case anything goes wrong.
Once you’ve backed up the current contents of your .htaccess file, you can add 301 redirects to the top of the .htaccess file.
Here are some examples of the types of 301 redirects that you can implement:
301 Redirect a Single Page via .htaccess
To redirect a single page to another single page, you can use:
Redirect 301 /old-url /new-url
Where each portion is the part of the URL that comes after your domain name (just like with the Simple 301 Redirects plugin).
Set Up 301 Redirects for Moving to SSL
If you recently set up SSL, you should add 301 redirects to send http traffic to https for better security and to avoid duplicate content.
To do that, add the following code snippet:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
301 Redirect an Entire Domain via .htaccess
If you’re moving your WordPress site to a new domain name, the following code snippet will redirect every single page on your old domain to the exact same page on your new domain (assuming you keep the same permalink structure):
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
You need to add this snippet to the .htaccess access file of your old domain name – not your new domain name.
Make sure to replace “newdomain.com” with your actual new domain name.
Wrapping Things Up
301 redirects are an SEO best practice whenever you change the URL of any piece(s) of content on your WordPress site.
To manage 301 redirects directly from your WordPress dashboard, Simple 301 Redirects is a great free plugin.
Otherwise, you can use .htaccess to manually 301 redirect all or part of your WordPress site.
Have any further questions about how to add 301 redirects to WordPress? Let us know in the comments and we’ll try to help out!
Ronnie Smith says
I can’t tell you how many times I’ve had to do redirects the old fashioned way, through the .htaccess file. I couldn’t stand WordPress for a long, long time. However, I know it seems silly, but once I found this tool on WordPress, it was one of the many reasons why I made the switch from Drupal. Seriously, life is so much easier with plug-ins like this.
Quintin says
Hi.
Can Simple 301 Redirects do this for me?
There is a new domain and architecture / page name change for some pages. I want to specifically redirect some pages and then have a catch all for the rest.
I found these examples – will they do what i need them to do?
// REDIRECT NON-EXISTING PAGES TO INDEX.PHP
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
AND ADD THE FOLLOWING FOR SPECIFIC PAGES
Redirect 301 /about http://newsite.com/about-this-company
Redirect 301 /contact http://newsite.com/contact-our-team
Redirect 301 /services http://newsite.com/our-great-services
Thanks in advance.
pavithra says
Hi there
I have many posts, now want to change the permalink from year, month, date version to post name version. Should i redirect for all the posts individually using plugin or any other method.
editorial-staff says
That’s a bit trickier. Give this a check https://yoast.com/change-wordpress-permalink-structure/