4 Methods to Create 301 Redirects in WordPress

4 Methods to Create 301 Redirects in WordPress

You may need to delete or move certain pages from your website. The life cycle of a website is cyclical.

If you move or delete a page, it could result in a 404 error that will prevent users from viewing your content. This can lead to a user leaving. You may be increasing your bounce rate and exit rates if you do not set up the redirects correctly; even if you are using the best WordPress hosting provider, it can’t save you from having a 404 error on your website on certain pages. This can negatively impact user experience, as well as organic ranking.

It is very easy to set up a 301 redirect in WordPress. By adding a redirect to the URL of redirected or deleted pages, both users and search engines will automatically be redirected to the updated, new URL. You can fix broken links by using a redirection plug-in or editing your website files.

In this article, we’ll explain how to create 301 redirects in WordPress with 4 different methods.

 

What is 301 Redirect in WordPress?

You’ll first need to understand what redirects do. Simply put, a redirect sends users and search engines to a different web address. The URL is automatically redirected to another location.

You can redirect your website visitors, to a different page temporarily or permanently. The “Not Found” error, also known as the 404 error, can disrupt the user experience and cause visitors to leave your site.

The HTTP status codes are unique and sent from the web server to the browser. These codes show how content is moved.

The most popular URL redirection types are:

301: Permanent redirection from one URL into another.

302: Temporarily redirect the user to a different URL.

303: Temporary replacement of content with a non-cached redirect.

307: Notifies search engines of the possibility that redirections may be updated periodically.

308: Redirect permanent that prevents the change from POST request method to GET.

Meta-refresh: A client-side redirection that often appears as a countdown to refresh.

 

The most common type of redirect is the 301. It will notify both online users and search engines that the resource has been removed. It will instead permanently redirect you to another page.

When someone clicks the link, they will automatically be taken to another URL. This will prevent users from getting 404 error messages and seamlessly redirect them to the right pages of your site.

 

Why You May Use a 301 Redirect

It can be confusing to choose the right redirect type for your site. The 301 redirection is useful for a number of essential tasks.

When you delete old content, a 301 redirect is a common solution. You’ll need to redirect users who are still visiting an old post to a new resource if the content is not relevant anymore.

301 redirect tells search engines you are permanently changing the URL. This redirect will improve Search Engine Optimization, as it preserves your traffic and links. Keep this in mind; search bots may take some time to find the new page.

You can also implement 301 redirects when you move to a different domain. If you don’t redirect your URLs, you may quickly lose your current audience. The 301 redirects, however, will take your visitors seamlessly to the new location.

A 301 redirect is also useful for moving from HTTP to HTTPS. It’s important to redirect all content permanently in order to ensure that users are directed toward the secured version of your site.

You may also consolidate posts. You can then redirect the links from the previous location to the new one after combining the information on one page.

How to Create 301 Redirect in WordPress

You may now want to implement 301 redirects on your website. We’ll discuss best practices for creating 301 redirects on WordPress.

Method 1: Installation of a Redirection Plugin

Installing a WordPress plugin is one of the easiest ways to enhance the functionality native to the platform. There are many plugins that can be used to create and manage redirects on your website.

This tool adds a manager for redirections to your website. This plugin allows you to create 301 redirects and track broken links. It also lets you migrate your permalinks.

Install and activate the Redirection plugin in WordPress. Navigate to > Tools > Redirection. Click on Setup on the welcome page.

You’ll then need to choose whether or not you want to have Redirection monitor your 404s, redirects, and permalinks. Select “Continue” and enable the options.

The plugin will then test the REST API and see if WordPress can properly communicate. After you have received a “Good” rating, you may click Finish Installation.

You can now create a redirection 301! Find Tools > Redirection and click on Add New. Add your target URL to the source URL.

Click on the gear to access additional settings. Select 301-Moved Permanently HTTP:

After you are finished, click Redirect. When users click on the old URL in their browser, they will be automatically directed to the new resource.

 

Method 2: Use an SEO plugin

You may not need new redirection tools like Simple 301 redirects or Redirection. Your website already has all of the necessary tools to implement redirects. SEO plugins often include redirection manager features along with Search Engine Optimization.

Rank Math, a free SEO plug-in with redirection features built in, is a great tool. This tool allows you to disable and delete redirects on your website. 

Open the dashboard after you have installed and activated Rank Math. Find the redirections and activate them.

You’ll now have a new redirections Tab. Click on Add New.

You can paste URLs in bulk by clicking Add Another. You can bulk-paste URLs by hitting Add Another. It is possible to combine multiple sources of information into one.

Select Exact Match next to each URL if you wish to redirect the exact link. You can enter more generic terms. Selecting contains will redirect all pages that contain the keyword.

Insert the URL you wish users to see under DestinationURL. Select Permanent Move before selecting Add Redirection.

 

Method 3: Create a Server-Side Redirect

You can add 301 redirects in WordPress even without a plugin. You can create 301 redirects using PHP as an alternative. It will use header() functions to create a redirection on the server.

They are often faster and safer because they’re server-side. This is a technical process and can go wrong. Before you begin, make sure that PHP is something you are familiar with.

You’ll have to use the header() function in PHP for a proper redirect. You can specify the destination URL in the response header field.

style=’font-size:12.0pt;font-family:Consolas;color:black; so-themecolor:text1′>header(‘HTTP/1.1 301 Moved Permanently’);

style=’background:white’>color:black;mso-themecolor:text1′>header(‘Location: https://www.example.com/newurl’);

style=’background:white’>color:black;mso-themecolor:text1′>exit();

Include a function like die() or exit() at the bottom of your header. Search engines such as Google might process your original page and not notice the redirect.

 

Method 4: Use .htaccess to Add 301 Redirect in WordPress

The most effective way to migrate a domain is by using the WordPress site’s .htaccess file. It’s possible to use the .htaccess files for page-level redirects. However, this is not as easy as using a plugin.

You’ll first need to access your website’s server and edit the .htaccess. There are two ways to do this:

  • Connect your server using FTP. (The credentials will be sent to you once you buy WordPress hosting)
  • Below, we use cPanel’s integrated File Manager.

1. Find your .htaccess files

Log in to the cPanel Dashboard of your server and find the File Manager.

You can then find it in the root directory of your website. Search for the file by its name.

2. Backup your .htaccess files

The next step is vital. If not managed correctly, the .htaccess file could have a negative impact on your website’s functionality. Make sure to back up this file before making any modifications. To do so, right-click the file and select “Download” from the menu.

3. Add the redirection code 301

After you’ve saved the file, click on “Edit” and select “.htaccess”. You can also right-click the file to select “Edit”. Click “Edit” to move on to the next step.

redirect a page from one page to another

Redirect 301 /old-page.html http://www.example.com/new-page.html

Replace the example URLs with the URLs for the pages that you wish to redirect.

Redirect the entire domain name to another name

The code will redirect visitors to the URL at a different domain. E.g. oldsite.com/example-post goes to newsite.com/example-post

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)oldsite\.com$ [NC]

RewriteRule ^ http://newsite.com%{REQUEST_URI} [L,R=301]

Replace the examples of domain names with your own old and new domain names.

Save the file after editing it to ensure that your redirection will work seamlessly.

 

Common Mistakes in Redirect

When building redirects for websites, it is common to confuse 301 redirects with 302 redirects. Both redirect users to a different page, but they do so in distinctly different ways. This can have a negative impact on your SEO.

We already mentioned that 301 redirects were permanent. Search crawlers will be informed to no longer index the original content as it has been permanently relocated. The new page will get the same link equity as the original.

A 302 redirect indicates that it is a temporary redirect. If you are testing a redesign, you can temporarily redirect your visitors to another page during the development phase. Search engines will index and PageRank the content if you use a 302 redirect.

You’ll also want to keep track of all redirects that you make. You could find yourself in an endless loop of redirects, which will increase the bounce rate. You’ll ultimately want to make it easy for both online users and search crawlers to access relevant content.

Last, but not least, ensure that you redirect visitors to relevant content. You’ll have to give useful information since the visitors clicked on your original link.

It will make the transition smooth and prevent users from leaving your site to go to a competitor. It will also ensure that crawlers understand your content, allowing you to rank higher on search engine results.

 

Conclusion

You’ll have to create 301 redirects if you want to move your domain or consolidate all of your content online. You can maintain your traffic while avoiding losing high Google rankings. Redirects also prevent users from clicking broken links.

Here’s a review of how to create 301 redirects in WordPress:

  •     Install the Redirect plug-in.
  •     Use an SEO plugin such as Rank Math.
  •     PHP can be used to create a redirection on the server.
  •     .htaccess to add 301 redirect

Leave a Reply

Your email address will not be published.