What is a 302 Redirect?
The 302 redirect status code indicates the requested resource has been temporarily moved to a new URL. It is also called 302 Found and was previously called 302 Moved Temporarily. It is used for temporary redirects.
When a client requests to access a resource, the server responds with a 302 Found along with a Location header field specifying the resource’s current location. The browser then redirects the visitor to the specified location.
The 302 Found redirect belongs to the 3xx series of HTTP status codes.
3
ステータスコードがリダイレクトであることを示しますxx
は a placeholder for two numbers indicating the type of redirection
How the 302 Redirect Works
The process begins with the visitor clicking a link, anchor text, or entering a URL into their address bar. For example, let us assume a visitor clicks on a link that leads to your homepage. Their browser will send the HTTP request below to your server.
GET /index.html HTTP/1.1 Host: yourdomain.com
However, you are currently redesigning your homepage, so you redirect all visitors to yourdomain.com/home.
As a result, your server responds with the HTTP code below, informing the browser that your homepage has been temporarily moved. The response includes a 位置 header showing the browser the new location of your homepage.
HTTP/1.1 302 Found Location: https://yourdomain.com/home
The browser will then make another request to your server, requesting to access your homepage at https://yourdomain.com/home.
GET /index.html HTTP/1.1 Host: https://yourdomain.com/home
The browser and server handle the 302 redirect. Visitors will typically not know a redirection occurred unless they pay attention to the URL they clicked on or entered into their address bar and the URL presented to them.
For example, when we run offers on our site, we redirect our pricing page from rankmath.com/pricing
に rankmath.com/offer
. So, anyone who visits our Pricing page is redirected to our Offers page instead.
Once the offer is over, we remove the redirection, and visitors looking to access our Pricing page land on our pricing page and are no longer redirected.
When to Use a 302 Redirect
You should use the 302 redirect when you intend to return to the originating URL in the near future. There are certain situations that may require this. Let us address them one by one.
1 When A/B Testing a Page
You may have encountered situations where you need to A/B test a page. For example, when testing a new design or wanting to see which page converts better.
So, you create two versions of the same page and send some visitors to one version while sending the rest to the other. In this case, you can set up a 302 redirect to send your visitors to the other version of the page.
2 When Updating a Page
The 302 redirect is helpful when you need to update an existing webpage without affecting its usability. For example, you may wish to update your site’s homepage while the page remains available to your visitors.
In this case, you will create a 302 redirect to redirect your visitors to a copy of the homepage while you work on the original homepage.
3 When Rectifying a Broken Page
Webpages can break without warning. This could be due to a server issue, a sudden traffic spike, or errors in your site code. Whenever you encounter such a situation, you will want to investigate the cause and rectify the issue.
However, the page may be important or receive a lot of visits. In that case, you can redirect visitors to a copy of the page while you attempt to resolve whatever caused the original page to break.
4 When Running a Sales Promotion
You may sometimes run promotions on your site. Instead of modifying your home or pricing page, it is best practice to create a new page for the promotion and redirect visitors to it.
Once the promotion is over, you remove the redirection and continue to serve your regular home and pricing pages to your visitors.
5 When Geotargeting Your Visitors
Your site may target a varied audience, requiring you to serve different pages to your visitors, depending on specific criteria like their location and language.
Instead of requiring your visitors to go to the URL relevant to their location or language, you can automatically detect those and use 302 redirects to send them to the appropriate URL.
How 302 Redirects Impact SEO
302 redirects are a hot topic in the SEO community. They are not very liked, and many site owners prefer using the 301 permanent redirect, even for temporary redirections.
However, Google has confirmed that 302 redirects are fine, and you should use the correct HTTP redirect code. Google has also provided more insights into how 302 redirects affect your SEO.
1 The Destination Page is Less Likely to Appear in Search Results
Google has confirmed it will display the page you are redirecting from in search results when you use the 302 redirect. This means the page you redirect to will not appear in search results.
This is somewhat expected, considering the 302 redirect is temporary, and Google expects you to return to the originating URL in the future.
2 302 Redirects Are a Weak Canonical Signal
It is common for multiple URLs to lead to the same page on a site. For example, http://yourdomain.com
と https://yourdomain.com
will typically lead to your homepage. However, Google considers both duplicates and will select one as canonical.
Google considers several signals to determine which URL to set as your canonical URL. This includes 302 redirects, which Google has confirmed are a weak signal that you want the destination page to be considered canonical.
3 302 Redirects Preserve Your PageRank
Google assigns a value to all webpages based on the quantity and quality of the pages linking to them. This value is called PageRank, and Google uses it to decide where your content will appear in search results.
Many SEOs believe 302 redirects cause their pages to lose PageRank. However, Google has confirmed you do not lose PageRank when you use any 30x redirect, including the 302.
Still on the 302 redirect, Google has specifically confirmed that 302 redirects do not cause you to lose PageRank. So, you should use 302 redirects where and when necessary without bothering whether it will affect your PageRank.
4 302 Redirects Can Be Treated as 301 Redirects
Google has confirmed it could treat your temporary 302 redirects as permanent 301 redirects under certain circumstances. Specifically, Google can treat your 302 redirects as 301 if:
- The 302 redirect remains on your site for a long time
- Google suspects you wanted to use a 301 but mistakenly used a 302 redirect
That said, Google did not specify how long a 302 redirect needs to remain on your site before it begins to treat it as a 301 redirect. Similarly, Google has yet to confirm how it determines you made a mistake when selecting your redirect.
よくある質問
1. What Does a 302 Redirect Do?
A 302 redirect indicates a resource has been moved to a new URL but is expected to return to the previous URL sometime in the future. In the meantime, the browser is required to visit the new URL to access the resource.
2. Should I Use 301 or 302 Redirect?
If the redirection is permanent and you do not intend to return to the previous URL in the future, you should use the 301 redirect. If it is temporary and you intend to return to the previous URL in the future, then use the 302 redirect. If you cannot determine whether you will return to the URL, use the 302 redirect.
3. Are 302 Redirects Bad for SEO?
302 redirects are good for SEO. They do not cause you to lose PageRank. Google uses 302 redirects to decide on several SEO issues, including selecting your canonical URL and determining which page to display on search results pages.
4. How Do I Fix a 302 Redirect?
A 302 redirect does not indicate an issue with your site. However, you can delete the redirect if you do not want the page to redirect any longer.