How to set up 301 redirects in WordPress

set up 301 redirects in WordPress

A redirect allows you to redirect one URL to another. This method redirects visitors and search engines to a different URL from the one they originally requested.

The advantage of set up 301 redirects in WordPress is that it allows you to maintain the ranking of the original page in the search engines.

In this article, you will learn about several types of redirects that you can use to structure your content and some examples of using redirects.

What is 301 Redirect

There are 3 types of redirects: 301, 302, 307 and meta update.

301 – Permanent redirect that transfers 90-99% of the link weight to the final page. In most cases, set up 301 redirects in WordPress are the best way to redirect your site.

The number 301 stands for HTTP status, which tells search engines that the page has been moved.

302 – Temporary redirect that transfers 0% of the link weight to the final page. This method is used in some cases, for example, a redirect to the “Maintenance” page, when the site is not available to visitors.

307 – The successor to the 302 redirect in HTTP version 1.1. Use this redirect for affiliate links.

Meta Refresh – Redirection that is done at the page level, not at the server level.

In most cases, a 301 redirect is used to redirect the URL, which preserves the position of the page in the search results.

Why set up 301 redirects in WordPress

Set up 301 redirects in WordPress is preferable for both users and search engines. It tells browsers and search engine crawlers that the page is constantly being moved.

Search engines interpret this to mean that not only the page URL has changed, but also the content, or its updated version is located at a new URL.

Search engines will carry over the link weight from the original page to the new URL.

With the help of 301 redirects, you can fix the structure of the site, solve problems with outdated content or with renaming the URL (slug), and make the site more understandable to the user. In doing so, you will save the link weight of the site and its position in the search results.

Examples of using 301 redirects

  • Redirect from http to https – If you have installed an SSL certificate on the site, set up a 301 redirect from the http version to https.
  • Domain to Domain Redirect – If your site is moving to a new domain, use a 301 redirect. A special case is moving from the www version to the non- www version, or vice versa.
  • Link to more relevant or complete content – Some articles become less relevant over time but continue to receive some traffic. If you’ve created a new page that collects or supplements information from one or more pages, use a 301 redirect.

For example, you have an article on your website about the top 5 tennis players. If you want to add information about another player, change the article title and URL from … / 5-best-tennis-players to … / 6-best-tennis-players , and add a 301 redirect.

How to set up 301 redirects using plugins

Redirection

The Redirection plugin allows you to customize set up 301 redirects in WordPress and maintains 404 error logs.

This plugin does not need access to the server and the .htaccess file , it works entirely inside WordPress.

A big plus of this plugin is that it keeps conversion statistics. You can see the number of transitions, when was the last transition, and who transitioned from where.

SEO Redirection

SEO Redirection allows you to quickly set up 301, 302, and 307 redirects. The plugin keeps records of 404 errors, which you can set up redirects for.

Enter the URL of the old page, the URL you want to redirect to and the type of redirect (301, 302, 307).

Quick Page / Post Redirect

Another plugin that allows you to set up redirects from one URL to another on your site or link to external sites.

The plugin has many settings, you can choose the type of redirect, import or export redirects, reconfigure redirects, or remove all settings.

How to make 301 manual redirects in .htaccess

One of the best ways to set up a redirect is to use the .htaccess file in your site’s root folder.

This is a simple and fast way that does not create database queries like a plugin does. This will have a microscopic effect on the speed of your site.

This method only works on Apache servers.

Page redirect

To create a 301 single page redirect, add this code to your .htaccess :

#Page redirect on the same domain
Redirect 301 /staraya-stranitsa /novaya-stranitsa

Replace staraya-stranitsaand novaya-stranitsayour URL. Pages can have extensions * .html, * .php and others, or not have extensions, as in this example.

Redirect a page to another domain

To set up 301 redirects in WordPress from one page to another domain, add this code to your .htaccess :

#Redirect a page on different domain
Redirect 301 /stranitsa https://noviy-sait.ru/stranitsa

Pages can have extensions * .html, * .php or others. Pay attention to http / https.

Site redirect to a new domain

To redirect the entire site, add this code to. htaccess :

#Redirect an entire site
Redirect 301 / https://noviy-sait.ru/

With this method, all links on your site will remain the same, that is, the page https://stariy-sait.ru/privet-mirwill become https://noviy-sait.ru/privet-mir. Pay attention to http / https.

Site redirect to a subfolder

To redirect the entire site to a subdirectory add this code to. htaccess :

#Redirect entire site to subdirectory
Redirect 301 / https://noviy-sait.ru/subdirectory/

Redirect to the www-version of the site

If you want your visitors to come only to the www version of the site, add this rule to. htaccess :

#Redirect to www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sait.ru [NC]
RewriteRule ^(.*)$ https://www.sait.ru/$1 [R=301,L]

Pay attention to http / https.

Redirect from http to https

To add a 301 redirect from the http version of the site to https , add this rule to. htaccess :

#Redirect to https
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.sait.ru/$1 [R,L]

Pay attention to www.

Redirect without 301

You can set up a redirect without a 301 redirect in the .htaccess file or plugin. You can set up a redirect using js, php, html and some other methods.

But all of these methods involve editing the code, just like in the case of. htaccess .

How to check 301 redirects

You can check the redirect status online using internet services such as redirect-checker .

Or using the browser’s built-in View Code tool (Ctrl + Shift + I):

  • Go to the Network tab ,
  • Check that the red button is on,
  • Go to the very top of the list, click on the first line,
  • Switch to Headers .
  • Check the status code.

Conclusion

Use a 301 redirect if your site has outdated content from which you can get link power to new content.

A 301 redirect also lets search engines know that you have fresh and relevant content.

Plugins offer an easy way to set up redirects on your site, but if you want the easiest way and don’t mind editing files on the server, you can add 301 redirects to your .htaccess file .

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top