How to Create 301 Redirects in WordPress

A 301 redirect is a type of redirection used to reroute visitors and search engines from one URL to another. It is often referred to as a “permanent redirect” because it tells the browser that the page or website has moved permanently to a new URL. This is different from a temporary redirect, which is indicated by a 302. When using 301 redirects, you are essentially saying that the old page has been replaced with the new URL.

WordPress sites often use 301 redirects when they change their URLs for any reason, including changing domain names or restructuring pages. Using 301 redirects ensures that visitors and search engines will be directed to the correct location without getting any errors. Additionally, using 301 redirections indicates to search engines that this change is permanent so they can adjust their index accordingly.

In this post, you will learn how to create 302 redirects in WordPress with and without using a plugin. Believe me, it’s very easy and anyone can do it without any help.

When should you use a 301 redirect?

Since a 301 redirect is permanent, it should only be used if you’re moving the URL of a page or changing the domain name to a new one.

Let’s say that the URL of a page on your site is www.yoursite.com/xyz and you want to change the URL to www.yoursite.com/abc. Then you will add a 301 redirect to the page www.yoursite.com/xyz to indicate to search crawlers and your website visitors that the page has moved to a new location.

This will avoid any inconvenience to your visitors and cause minimal upheavals in your search rankings.

How to implement a 301 redirect in WordPress?

Fortunately, it’s very easy to implement 301 redirects in WordPress. Also, there are multiple methods to implement a 301 redirect in WordPress. Which method you should use depends on your need like whether you wish to redirect a page, multiple pages, or the entire domain.

Setup 301 redirect in WordPress without a plugin

The first method is without using a redirection plugin with the help of the .htaccess file.

You will need to first locate your domain’s .htaccess file. Usually, this is found in the root directory where WordPress is installed. You should have access to the File Manager or at least have FTP access to edit the .htaccess file.

.htaccess file location in WordPress
The .htaccess file

Once you open the .htaccess file, add the following lines to it:

Redirect 301 /old-url/ https://www.example.com/new-url/ 

Be sure to replace /old-url/ with the old URL that you want to redirect and https://www.example.com/new-url/ with the new URL that you want the old URL to redirect to.

If you wish to redirect your domain to another domain, you should add the following code to the .htaccess file:

Redirect 301 / https://www.example.com/

Replace example.com with the domain name that you wish to redirect your website to.

Remember to save the .htaccess file. If you’re using an FTP client, you should upload the file back to the server for the changes to reflect on your website.

While this method of adding 301 redirects is pretty simple, it can become cumbersome if you need to add 301 redirects to pages frequently. Further, if you wish to remove the 301 redirects for any reason, you will need to again edit the .htaccess file.

That’s why you should also know how to..

Setup 301 redirects in WordPress using a plugin

To set up a 301 redirect in WordPress, you can use a plugin like Redirection. Here are the steps to follow:

  1. Install and activate the Redirection plugin on your WordPress site.
  2. In the WordPress admin dashboard, go to Tools > Redirection.
  3. Click the Add New button to create a new redirect.
  4. In the Source URL field, enter the old URL that you want to redirect.
  5. In the Target URL field, enter the new URL that you want the old URL to redirect to.
  6. Click the Add Redirect button to save the redirect.
Setup Redirection plugin in WordPress

You can leave the other options like Query Parameters to their default settings. But if you need more granular control over the redirection, you can change the URL options to regex, or make it ignore slash or case.

Redirection is currently active on more than 2 million websites and is probably the easiest and most convenient way to set up permanent 301 WordPress redirects without touching any code. You can change the redirect URL anytime you want from the comfort of your admin dashboard.

Redirect using an SEO plugin

If you don’t wish to use an exclusive plugin for adding redirects, then you can also use the built-in feature of SEO plugins to add page-level redirects. Most SEO plugins offer a redirect feature. These include the popular Yoast SEO and RankMath plugins.

Test your redirects

Once you’ve added a redirect, you should test it to ensure that the redirect works exactly as intended.

Summary

Setting up redirects in WordPress is pretty easy and can be done on the server level using the .htaccess file or from within the WordPress admin dashboard using the Redirection or an SEO plugin. The only thing to know is which redirect to use and when.

If you’re moving the page to a new location temporarily, then you should set up a 302 redirect. But more often than not, the change will be permanent. In this case, you should set up a 301 redirect to indicate to users and search engines that the page has permanently moved to a new location.

About Trishan Mehta

Trishan Mehta is a WordPress fanatic since 2009. When not WordPressing, he is busy exploring hidden natural getaways whenever he can grab an opportunity. You can grab his WordPress SEO eBook to get up to speed with WordPress SEO.

Leave a Comment