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!
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.
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.
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.
Below, I’ll show you two methods to add 301 redirects to WordPress to handle these various situations.
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:
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:
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:
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.
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:
That configuration means that:
You can even get more creative with wildcard redirects if you want. Here are some examples from the plugin’s documentation:
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:
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).
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]
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.
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!
SeedProd is one of the elders of the WordPress ecosystem. It's also a bit of…
Really Simple Syndication (RSS) feeds are a vital component of the WordPress ecosystem. They act…
It’s that time of year again when people start revving up their shopping lists, hunting…
Forget music being the food of love, WordPress has a love for food. You can…
If you clicked on this post, I’m guessing you want to find the best solution…
Trying to figure out how to start an online course so that you can share…
View Comments
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.
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.
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.
That's a bit trickier. Give this a check https://yoast.com/change-wordpress-permalink-structure/