So you’ve decided to move your content, replace some URLs or merge pages with duplicate content, but you want to keep things search-engine friendly and retain the value of your content.

How do you manage this correctly in terms of SEO? First, add a flexible tool to your arsenal – 301 redirects. Their primary purpose is to redirect the user and the search robot to the right place without losing link weights. However, improper configuration and other errors in the work with redirects can harm your rankings. In this article, we’ll tell you how to set up 301 redirects correctly, when you need them, and their meaning in SEO. In addition, you will learn about other types of redirects and how to deal with them.

When to use 301 redirects?

  • Responsive design. The most popular redirect is redirecting the user from the desktop version of the site to the mobile version.
  • When rebranding. In cases where you changed the brand name and moved to a site with a new domain name.
  • When you switch to a secure connection protocol: change the HTTP protocol to HTTPS to protect yourself and your clients.
  • To redirect from irrelevant pages/sites. For example, a product is no longer on sale, or you no longer provide a service and want to redirect the user to a page with a similar product or service.
  • When sites or pages are duplicated. Similar content on several resources worsens the ranking, and if the sites or pages are identical, search engines will exclude these pages from the search. Permanent and temporary redirects will be helpful to avoid creating duplicates and risking ranking.
  • With frequent queries with a www, if your site is without a www. You can be linked to both, but they are different sites for search engines, so it’s a good idea to set up a redirect to just one of the pages.
  • When migrating to a new site engine. Each CMS has its own rules for generating URLs. If the address does not match the old one, you can not do without a redirect – otherwise, customers will never find you. 
  • 404 pages. Sometimes it is necessary to set a redirection up from a broken page to a live one.

What is a 301 redirect in SEO?

301 redirect benefits for SEO:

  • Save traffic;
  • Prevent the loss of PageRank;
  • Get rid of duplicate pages;
  • Eliminate the presence of low-quality pages in the search results;
  • Redirect the crawler (search bot) and the user from an irrelevant page or with a 404 server response code.

From a user experience standpoint, 301 redirects are helpful because they allow redirecting traffic to related products if the one they are looking for is deleted. Such practice reduces the probability of user bounce.

Some time after you set up the redirect, the search engine will update its index, replacing the old page address with the new one. Browsers and other types of clients will cache the new URL and automatically follow the redirect directly without checking the original for subsequent requests. Saved bookmarks are also usually updated.

How to set up 301 redirects?

There are many ways to make a 301 redirect: .htaccess, PHP, javascript, server settings, and others. We recommend not using all methods at once. There is too high a probability of discrepancies between different processes. The most commonly used way of configuration is through .htaccess. 

What is the .htaccess file for, and how to find it?

The .htaccess file is a configuration file that defines the rules of the web server in the directories and subdirectories where it is located. Most often, it will be the root folder of your site.

If you can’t find the .htaccess, there are a few options:

  1. The file has a different name. It is scarce, but it is possible. The actual name can be clarified with the hosting provider: it can be, for example, .config, .htaccess.http, access.conf.
  2. The file still needs to be created. This is the most common case. It is necessary to create a .htaccess file and write the redirection directives into it later.

Further info on .htaccess – https://wordpress.org/documentation/article/htaccess/

How to create a new .htaccess file?

  1. Create an empty text file with a .txt extension.
  2. Rename it by removing the name and adding the extension .htaccess. 
  3. If you work on macOS, a file with no name will not be visible. Then give it any name you want, and rename it after it is uploaded to the server.

Setting up 301 redirects in .htaccess with examples

We will use the conventional addresses of sites and pages to show you 301 redirect examples – you will need to replace them with yours.

301 redirect of one page

The easiest way is to use the Redirect directive. Try one of the options:

Redirect 301 /old-page /new-page

or

Redirect 301 /old-page/ https://your-site.com/new-page

You can also redirect with the module mod_rewrite:

RewriteCond %{REQUEST_URI} ^/old-page/$

RewriteRule ^.*$ http://your-site.com/new-page/? [R=301,L]

301 redirect from the domain without WWW to the domain with WWW

It is necessary for gluing duplicate pages like sitexample.com and www.sitexample.com when you decide to make the leading site with the WWW prefix.

RewriteCond %{HTTP_HOST} ^site\.com$ [NC]

RewriteRule ^(.*)$ https://www.site.com/$1 [R=301,L]

301 redirect from the domain with WWW to the domain without WWW

RewriteCond %{HTTP_HOST} ^www.site.com$ [NC]

RewriteRule ^(.*)$ https://site.com/$1 [R=301,L]

301 redirect using RewriteRule

RewriteRule is a directive of the .htaccess file, the mod_rewrite module, which defines URL conversion rules. Use it when you need to perform a mass 301 redirect.

By default, the mod_rewrite module is disabled. To enable it, you need to use the directives:

RewriteEngine on

RewriteBase /

The principle of the module is built using the rules according to which the URL is converted.

Two directives serve to define the rules:

  • RewriteCond – defines the conditions under which the RewriteRule directive will be triggered. The number of RewriteCond conditions before the RewriteRule directive is unlimited.
  • RewriteRule – sets the URL conversion rule.

Example of RewriteRule for redirection:

RewriteRule ^my-old-url\.html$ /my-new-url.html [R=301,L]

  • The first part of the rule specifies the condition under which the URL conversion will be performed.
  • The second part of the rule determines what the URL should be converted to.
  • The third part of the rule (in square brackets) contains additional options called flags. It is optional. In our case, it includes the redirect code – R=301, as well as the flag L – “last rule,” which says to stop the URL conversion process if it matches the rule.

301 redirect from domain to domain

Used when it is necessary to stick together old and new pages after changing the domain.

RewriteCond %{HTTP_HOST} ^old-site.com$ [NC]

RewriteRule ^(.*)$ https://www.new-site.com/$1 [R=301,L]

301 redirect to HTTPS from HTTP

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

301 redirects from a page with a slash to a URL without a slash, and vice versa

On a URL without “/”

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^(.+)/$

RewriteRule ^(.+)/$ /$1 [R=301,L]

On a URL with a “/”

RewriteCond %{REQUEST_URI} /+[^.]+$

RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

But even with a ready-made code for different needs, something could go wrong, and the best option is to contact a programmer. Since it is possible that you accidentally catch another type of page or dynamic data that you need or something else, it is essential to check all pages after implementing the code.

How to set up a 301 redirect in WordPress?

At the beginning of 2019, approximately 75 million sites were implemented using CMS WordPress. It allows you to solve a wide range of tasks with the help of plugins. This is also true for 301 redirects. If you need to redirect from one page to another, it is unnecessary to involve a programmer. It will be enough to use a plugin.

301 redirect with the 301 Redirects plugin

  1. Setup plugin and install it in WordPress
  2. Configure the plugin. To do this, go to the “Settings” tab with the plugin’s name.

3. Select the type of redirect. The plugin allows you to implement different types of redirects: 301, 302, 307. To implement a redirect, you need to select the desired redirect type from the menu in the Redirect Rules tab:

4. Next, you need to specify the relative link of the page from which to perform the redirect and the link to which it should be committed. Then click the “save” button.

You can check the result after saving. To do this, enter the URL from which you made the redirect in the address bar. You should be redirected to the page whose URL you specified in the second field.

Important! If you have any problems with the redirect, make sure that all fields are filled in, and the cache is cleared. To do this, go to the Tools & Options tab and click on the Empty Cache button.

After clearing the cache, recheck the redirect.

When should you avoid 301 redirects?

No one should use a permanent redirect for temporary solutions; it is evident from its name. For temporary movement, use 302 Redirect Moved Temporarily. In this case, there will be no gluing of pages, and the site owner can restore the page with the redirect at any time.


If there are any problems with your domain, for example, filters or bans, and you decide to change the address of the site (domain), you should not make a 301 redirect from the old domain to the new one – as a result, you will stick all the problems of the old domain to the new one. In the end, nothing will change.

Other Types of 3xx Redirects

302 Redirect – Moved Temporarily

Suitable for cases when some page or section of the site is under technical maintenance. You can redirect users to a copy of the old page version at this time. It is a signal for the search engine that removing the donor page from the index is unnecessary, and there is no need to index the acceptor page. 

However, if the 302 redirects stand for a long time, the search bot may consider this a permanent move and make appropriate changes in the index.

We know about the practice when online shop owners set up a 302 redirect for a product that is out of stock. We don’t recommend doing this. It’s better to specify that the product is out of stock now and add a block with similar or exciting products on this page.

303 and 307 Redirect 

307 redirects (Temporary Redirect) is an exact copy of the 303 (Found) redirect for search engines. It is a temporary redirection of traffic to a new page with all the parameters of the original page.

These types are used when there is a need to redirect the user to another page that does not contain an exact answer but is a partial replacement of the search query.

303 and 307 redirects have been created to differentiate between the two supposed features of the 302 response code. In practice, no SEOs intentionally use either of them. 

304 Redirect – Not Modified 

Browsers can send a request that asks if the resource has been modified. We can assist the browser by controlling The Last-Modified and If-Modified-Since headers to enter information about the last editing of a web page.

The primary purpose of using If-Modified-Since and Last-Modified headers is to ensure that cached information is updated efficiently. Cache management will help improve page load speeds, as well as improve overall website performance and, thus, user experience.

From an SEO point of view, monitoring cache updates is very important because it can improve the crawling and indexing of the site.

You do remember that each site has a specific crawling budget, and the task of the optimizer is to use it as effectively as possible.

The 304 redirect is the most helpful for owners of large sites who meet problems with scanning. The search robot scans pages that are non-priority and may never get to the necessary content. For example, the ‘About us’ page is frequently scanned because there is a link to it on every site page in the header or footer. Therefore, the robot may consider it important, but it is not.

By configuring If-Modified-Since and Last-Modified, you can show the robot which pages you updated and which have remained unchanged.

305 Redirect – Use Proxy 

305 redirects occur when the requested resource is available only through a proxy server. The web browser is expected to repeat the request through the proxy.

Some browsers (Mozilla, Internet Explorer) mismanage this status. Most likely, they regard the fact that the request is not sent directly to the server as insecure.

Programmers use proxy servers for various purposes, ranging from anonymity to the need to cache content to speed up page loading.

We note that many search engines ignore this code and, in fact, abandon it.

306 Redirect – Switch Proxy

Initially, the 306 response code signaled that the client must use a specific proxy server. It is no longer relevant and remains reserved.

308 Redirect – Permanent Redirect

This response code is similar to a 301 redirect, with the only difference being that it does not allow you to change the request method from POST to GET. It’s also automatically cached and passes internal weight to the new page.

It’s worth noting that this response code is experimental.

There are other use cases for the 308 redirect. For example, Google Drive redirects with a 308 response code to show that a data download was interrupted.

Which redirects should SEO experts use?

We work with the following redirects: 301, 302, 304, 307, 308. But we actually use 301, 304, and 302. Can you guess why?

Yes, because all browsers, clients, and search engines do not yet love the 307 and 308 server response codes. So let’s communicate with them in a language they understand.

Most Common Mistakes With Redirects

Redirect robots.txt

When changing a site’s domain, the owner sometimes sets up a mass redirect of all pages and files, including the robots.txt file. But, to glue domains faster for search engines, the robots.txt on the old domain should be available for scanning, not redirected.

The acceptor page is not relevant to the donor.

The main advantage of 301 redirects for SEO is the transfer of weight and authority from the old page to the new page. However, if you put a redirect to a page that is irrelevant to the donor – with different information, a completely different product – then the search engines will consider it wrong. The weight will not be fully transferred. In some cases, the search engine will not consider it a redirect at all.

Redirect chains

We can often encounter situations of multiple-page redirects.

For example, you delete page A and redirect to page B. Later you delete B and redirect to page C. As a result, a user who wants to go to page A is first redirected to page B and then to C. The robot may not understand why you’re doing this.

Ideally, the redirect on page A should be fixed by putting it right on page C. And here, the robot is happy – the redirect is done correctly.

What’s wrong with redirect chains:

  • They slow down the opening of the final page, worsen the behavioral performance of the site and Core Web Vitals;
  • Search robots can handle no more than five redirects;
  • Increase the risk of redirect loops leading to the page’s inaccessibility.

You can detect redirect chains with WebCEO’s Technical Audit Tool for free. Just add your project, and it will be automatically scanned. Afterward, move to the Site Health menu and check if your site has any redirect chains.

Redirect loops

Redirect Loops

A fictional example: you have set up a redirect from page A to page B and from there to page C. But page C is already redirected to page A. We get a vicious redirect loop. All URLs in the chain become inaccessible to users and search engines.

In practice, redirect loops often occur when mass redirect rules are confused: pages with and without the slash, with and without WWW, etc.

You should avoid redirecting loops because they negatively affect your ranking by increasing the content loading time, wasting crawling budgets, and decreasing link weight.

Pages with code 301 remained in the sitemap.

You must remove URLs with 301 redirects from sitemap.xml. Otherwise, the search robot will spend its crawling budget to crawl these pages.

Redirect to the 404 page

Check the relevance of redirects on the site regularly, especially after cardinal restructuring and removal of irrelevant pages. It often happens that you put a redirect, but after some time, the URL acceptor was deleted, or it became inaccessible because of technical errors. As a result, redirects lead nowhere to a broken link.

Unusual Ways to Create Redirects (Redirects via meta refresh, javascript, and PHP)

PHP redirects

The main feature of the redirect in PHP is that redirection is not written in the page’s code but with the help of a script on the server. This reduces the susceptibility to search engine filters. You need to find the PHP file in the site’s root folder and enter a line of code for the appropriate redirect.

This type is slower than .htaccess, but if you have hundreds of pages that need to be redirected and want to do it selectively rather than all of them, PHP might be the best choice.

JavaScript redirects

This differs from the previous ones in that the redirection takes place on the browser side, not the server side. Therefore, the redirection speed is drastically reduced because the script must fully load to perform actions.

When do you use this? For example, when you move to a new site, it displays a message like “you will now be automatically redirected to our new site.”

The JavaScript redirect should be set up in the page’s source code from which the redirect comes by changing the text between the <head>-</head> tags.

HTML redirect or meta-refresh

A browser type of redirect. It is a meta tag, which usually specifies the delay time and the page to which the user is redirected.

Example code for a meta refresh tag with a redirect delay of 2 seconds

<meta http-equiv=”refresh” content=”2;https://livepage.pro”>

The meta-refresh has a bad reputation among search engines, as this method has often been used to redirect to doorways. In addition, meta-refresh has other disadvantages:

  • Is not supported by all browsers;
  • Leads to crawl errors. The search robot does not crawl the page on which the refresh meta tag is located but goes directly to the one to which the redirection leads;
  • Can be defined by Google as spam with appropriate sanctions;
  • Google bots may ignore pages with this meta tag and not index them.

However, in some cases, the use of such a redirect may be appropriate, for example, for:

  • Redirecting the visitor to the gratitude page after placing an order;
  • “Backing up” redirects implemented in JavaScript – if the visitor’s browser does not support scripts;
  • Redirecting the visitor to the page with links to download the correct browsers – if his browser displays your site with errors.

Summary

  1. A 301 redirect is a significant SEO optimization tool that improves the user experience and communication with search engine robots. It allows you to save the weight of pages, glue them together, save traffic, and retain the user. However, it’s crucial that you use the correct type of redirect status code for your purpose to get the correct outcome.
  2. There are different ways to implement 301 redirects. The most common are edits in the web server configuration file (.htaccess). When implementing 301 redirects through the .htaccess file, site owners use classic 301 redirects or the RewriteRule directive.
  3. It is unnecessary to involve a programmer in implementing 301 redirects on different CRMs. The task is easily solved using modules or platform features.
  4. There are many different redirects, but 301, 302, and 304 will affect your SEO 98% of the time.
  5. Avoid redirect chains and redirect loops, as they can seriously worsen your rankings.
  6. Be very careful, and be active in checking the result of your settings. When working with redirects, it is easy to make mistakes and affect other pages or files. 

To make sure your site is search-engine friendly, check your site for technical issues and redirects with the help of the WebCEO Auditor Tool. 

Check for Technical Issues Sign Up Free