What Is a 302 Redirect and How It Works
302 redirect is a temporary redirect status code that tells browsers and search engines a webpage has moved temporarily to a different URL. Unlike a permanent redirect, it does not pass full SEO value to the new page because the original URL is expected to return soon.How It Works
A 302 redirect works like a temporary detour sign on a road. When someone tries to visit a webpage, the server responds with a 302 status code telling the browser, "This page is temporarily at a different address." The browser then goes to the new URL but remembers the original one for future visits.
This means search engines understand the move is not permanent and keep the original page indexed instead of replacing it with the new URL. This helps when you want to send visitors somewhere else for a short time without losing your page's search ranking.
Example
This example shows how to set a 302 redirect using an HTTP header in PHP. It tells the browser to temporarily go to a new page.
<?php // Send a 302 redirect header header("Location: https://example.com/new-page", true, 302); exit(); ?>
When to Use
Use a 302 redirect when you want to send visitors to a different page temporarily. For example:
- During website maintenance or updates
- When testing a new page without affecting SEO
- For seasonal promotions or limited-time offers
It is important not to use 302 redirects for permanent moves because search engines may not transfer ranking signals to the new URL.
Key Points
- A 302 redirect is temporary and does not pass full SEO value.
- It tells browsers and search engines the original URL will return.
- Use it for short-term page moves or testing.
- For permanent moves, use a 301 redirect instead.