by Ravi Chauhan | Jul 13, 2020 | SEO | 0 comments

“Redirect processing” is necessary when renewing a website or moving pages. Redirection is a series of flow that automatically transfers the accessed user to another page. If you don’t do proper redirect processing, it can be a big negative SEO.

There are multiple ways to set redirects, but the prerequisite is to understand the “redirect type”. Major ones are 301 redirects and 302 redirects. Depending on the purpose of the redirect, you will be able to correctly determine which method to choose.

In this article, we focus on “302 redirects” among redirects, and explain the criteria for when to use them and the difference from the often mistaken 301 redirects.

What is a redirect?

Redirection is the process of automatically transferring a user who has visited one page to another page. For example, when a certain web page is renewed and the URL is changed, there are many people who have experienced transitioning to the new URL automatically when accessing the old URL. This process is redirect.

What is a 302 redirect?

A 302 redirect is a process for transferring a URL “temporarily”.

There is no specific standard for how much is “temporary”, but when redirecting from the 302 redirect destination to the original URL before the redirect, 302 redirect is used.

When 302 redirect is set, the information displayed on the page before transfer is displayed in search results such as Google. The pre-transfer page is displayed because the 302 redirect is meant to be a temporary redirect.
If you do a renewal and use 302 redirects when the URL is not temporary and changes all the time, the URL of the transfer destination will be displayed if Google determines that it is not a temporary transfer.

When to use 302 redirects

302 redirects are used for temporary URL transfers. Based on this point, as a specific case where 302 redirect is used,

  • When transferring to a URL that is used only for a certain period, such as during maintenance
  • When changing the display page according to the device the user is accessing
  • When you want to do A/B test

There are three possibilities.

– When transferring to a URL that is used only for a certain period, such as during maintenance

If you cannot temporarily publish the current page, such as when the website is under maintenance, create a separate page to indicate that it is under maintenance and set it as the forwarding destination.

In addition, if you have a seasonal sale or campaign for a limited time, we may use a 302 redirect to move to the corresponding page.

– When changing the display page according to the user’s access environment (region or device)

The 302 redirect is also used for setting when changing the displayed page according to the access environment. For example, when you want to change the display page depending on the device (access from smartphone or PC).

– When you want to do A/B test

Creating multiple versions of a page, distributing users, comparing the reactions of each user, and verifying the effect is called “A/B test”. According to Google Search Console help, 302 redirects are mentioned as a recommended method for A/B testing.

The difference between a 301 redirect and a 302 redirect

Similar to 302 redirect, there is a “301 redirect” process that transfers to a different URL. The user side does not mean that “when I visit a page, I automatically move to another page”, but there are differences that the website operator should understand.

– What is a 301 redirect?

301 redirect is one of the http status codes and one of the transfer processing codes used when the URL is permanently changed.

“Permanent” means “every time”. For example, this setting is used when you no longer want to use the old URL, such as transferring a site or transferring a domain.

As one of the SEO measures, the redirect used when normalizing the URL is also 301 redirect.

301 redirects are “permanent”, 302 redirects are “temporary”

The biggest difference between a 301 redirect and a 302 redirect is whether the URL transfer is “permanent” or “temporary”.  The 301 redirect is “to tell the person who visited the house that you will not move and come back there along with the address of the moving destination”, In 302 redirect you tell them that you live in a temporary home together with the address of your temporary home but you will move back.”

The difference between permanent and temporary will appear in the search results. For 301 redirects, the search results will show the new redirected URL. In the case of 302, it is assumed that the original URL will be returned to, so the original URL is usually displayed as is.

Both page ranks are inherited

Previously, there was a difference in passing the page rank.
Since 302 redirect evaluates the page before transfer (temporary page is not subject to evaluation), it was said that the page rank will not be inherited to the transfer destination page.

However, in 2016 Google’s Gary said on Twitter, “30x redirects don’t lose PageRank any more.” We have found that redirects do not cause page rank loss. The page rank is inherited in the same way for both 301 redirects and 302 redirects. The Google Search Console help also states that “301 and 302 redirects do not lead to PageRank loss.”

If the page rank is lost without redirecting, the SEO rating of the page set as the redirect destination will start from 1, and it will take some time before it is displayed at the top of the search. However, if you do a 301 or 302 redirect, you will not lose the page rank. Therefore, even if you have a different page set for each device, or if you are redirecting to a different page in a seasonal campaign, you can minimize the impact on the search ranking.

Time to change index URL

It is the same in 301 and 302 that the transfer source URL is inherited by the transfer destination. However, 301 redirects are considered to be quicker until the search engine recognizes the transfer of the URL. Because 302 redirect is used for temporary transfer, URL before redirect is indexed. However, even if you use a 302 redirect, if you determine that the transfer is permanent like a 301 redirect, the destination URL will be indexed.

Therefore, if you want to index the transfer destination URL, it is better to set 301 redirect.

How to do a 302 redirect

There are three ways to set a 302 redirect:

  • Use .htaccess (general)
  • Use PHP (for web servers that cannot use .htaccess)
  • Use plug-in (for WordPress)

Each of the following items will be introduced in detail.

Use .htaccess

A common way is to leverage .htaccess files. .htaccess is a configuration file that controls “Apache” (Apache) used in the Web server. In addition to redirect settings, you can also set access restrictions and view authentication.

Create .htaccess file

If you have a .htaccess file on the server that manages your website, download and edit it. If the file does not exist, write it in a text file and save it as “.htaccess”.

If you want to set 302 redirect, the description method is as follows.

<If you want to redirect the entire site>

RewriteEngine On
RewriteCond %{http_host} ^www.before.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=302,L]

<If you want to redirect some pages>

RewriteRule ^/old-page.html$ http://www.example.com/$1 [R=302,L]

* Please rewrite www.before.com, http://www.example.com/, old-page.html as appropriate. Please note that the full path (http~) is included on the relocation page.

Upload to server

After writing it in the file, save it and upload it to the server. Use FTP software, etc., and set it at the top of the directory you want to reflect. If you put it in the root directory, it’s OK.

Redirect will be executed only after uploading, so let’s confirm if it is working as expected after uploading is completed.

Use PHP

If you are using a PHP file, you can also set the redirect by adding the following description at the beginning of the PHP file of the page you want to set the redirect. Depending on the server, the use of .htaccess may be restricted. In that case, please use this method.

<?php
header(‘Location: http://www.tmp-url.com/’, true, 302);
exit();
?>

It’s easy to set up, but you have to write it in each file, so you need to work with all the files you want to set up redirects for. In some cases, the amount of work will increase.

Use WordPress plugin

For websites that use WordPress, it is easy to use the plugin. A plug-in called “Redirection” is often used (it is safe because it is an official WordPress plug-in).

Please install and enable this plugin. Then, “Redirection” is displayed in “Tools” on the left menu of the management screen, and you can freely set transfer rules.

Enter the following two points on the setting screen.

  • Source URL: Enter the URL of the transfer source page
  • Target URL: Enter the URL of the transfer destination page

The default is 301 redirects, so display the advanced settings and select 302 redirects.

Conclusion

There are roughly 302 redirects and 301 redirects. It doesn’t make a big difference in terms of SEO, but let’s use it properly to build a site that is easy for users to understand.