What Is a 302 Redirect and How to Use It Properly
A 302 redirect is an HTTP status code (302 Found) that signals to browsers and search engines that a URL has been temporarily moved to a new location. Unlike a permanent redirect, the original URL retains its indexed status and accumulated link equity β search engines are explicitly instructed to keep crawling and ranking the source URL, not the destination.
This distinction is not cosmetic. Choosing the wrong redirect type is one of the most common and costly SEO mistakes in web infrastructure management. If you permanently migrate content but serve a 302, you silently bleed ranking signals for months before noticing the damage in Search Console.
The HTTP Redirect Landscape: 302 vs. 301 vs. 307 vs. 308
Before diving into implementation, it is essential to understand where 302 sits within the broader HTTP redirect taxonomy. Many engineers conflate 302 with 307, and many site owners conflate 302 with 301 β both errors carry real consequences.
| Code | Name | Permanent? | Method Change Allowed? | Link Equity Passed? | Primary Use Case |
|---|
| —— | —— | ———— | ———————- | ——————– | ——————– |
|---|
| 301 | Moved Permanently | Yes | Yes (GET on redirect) | Yes | Permanent URL migration |
|---|
| 302 | Found (Temporary) | No | Yes (GET on redirect) | No | Temporary redirect, legacy use |
|---|
| 307 | Temporary Redirect | No | No (method preserved) | No | Temporary redirect, strict method preservation |
|---|
| 308 | Permanent Redirect | Yes | No (method preserved) | Yes | Permanent redirect, strict method preservation |
|---|
| 303 | See Other | No | Yes (always GET) | No | Post/Redirect/Get pattern |
|---|
| meta refresh | N/A | Varies | N/A | Weak/none | Client-side fallback only |
|---|
Key architectural note: HTTP/1.1 introduced 307 precisely because 302 had ambiguous behavior β early browsers would change POST requests to GET when following a 302. If you are redirecting form submissions or API endpoints, use 307 (temporary) or 308 (permanent), not 302 or 301. For standard page redirects, 302 remains the correct and widely supported choice for temporary scenarios.
When a 302 Redirect Is the Correct Tool
The decision to use a 302 should be driven by a single question: Is this URL change genuinely temporary, with a defined end date? If the answer is yes, 302 is appropriate. If the answer is "probably" or "indefinitely," use 301.
Scheduled Maintenance Windows
When a specific page or an entire site is taken offline for database migrations, server upgrades, or emergency patching, a 302 redirect to a maintenance notice page is the correct response. Search engines will continue to hold the original URL in their index and resume normal crawling once the redirect is removed.
A subtlety many administrators miss: for site-wide maintenance, pairing the 302 with a Retry-After HTTP response header on the maintenance page gives Googlebot a crawl-back hint, reducing unnecessary re-crawl attempts during the downtime window.
A/B Testing and Multivariate Experiments
Redirecting a subset of traffic from a canonical URL to a variant page for conversion rate optimization must use a 302. Using a 301 here would cause Google to eventually consolidate ranking signals onto the variant, which may be discarded after the test concludes. Tools like Google Optimize (now deprecated) and modern alternatives like VWO or Optimizely handle this at the JavaScript layer, but server-side 302 redirects offer more reliable crawl control.
Edge case: If your A/B test runs longer than 90 days, Googlebot may begin treating the 302 as a de facto permanent redirect and start indexing the variant. Audit redirect ages regularly.
Temporary Promotional Campaigns
Seasonal landing pages β flash sales, event registrations, limited-time offers β should be served via 302 from the primary URL. When the campaign ends, removing the redirect restores the original page without any SEO remediation work.
Example flow:
https://example.com/products β 302 β https://example.com/black-friday-saleAfter the campaign, the redirect is removed and https://example.com/products resumes serving normally, with no link equity lost.
Geolocation and Language-Based Routing
Serving region-specific content variants (e.g., /de, /fr, /us) via 302 redirects based on IP geolocation is a legitimate use case, but it requires careful implementation. Google explicitly states that geolocation redirects should not prevent Googlebot (which crawls from US IPs) from accessing the canonical content. Always ensure the default locale is accessible without redirection for the crawler.
Combine geolocation 302s with hreflang annotations in your sitemap or <head> to give search engines the full picture of your international URL structure.
Logged-In vs. Logged-Out User Routing
Web applications frequently redirect unauthenticated users from protected resources to a login page. This is a 302 by definition β the resource exists and will be accessible once the user authenticates. Serving a 301 here would be semantically incorrect and could cause browsers to cache the redirect, breaking the authentication flow for returning users.
How to Implement a 302 Redirect: All Major Methods
Apache: .htaccess Configuration
On Apache-based hosting environments, the .htaccess file in your document root is the standard configuration point. Ensure mod_rewrite or mod_alias is enabled.
Simple redirect using mod_alias:
Redirect 302 /old-page https://example.com/new-pagePattern-based redirect using mod_rewrite:
RewriteEngine On
RewriteRule ^old-page/?$ https://example.com/new-page [R=302,L]The [R=302,L] flags explicitly set the response code and mark the rule as the last to be processed. Omitting the status code defaults to 302 in Apache's mod_rewrite, but being explicit prevents ambiguity when other engineers read the configuration.
Important: Avoid placing 302 rules inside a <IfModule mod_rewrite.c> block without verifying the module is loaded. A silent failure here means no redirect fires and no error is logged at the default log level.
Nginx: Server Block Configuration
Nginx handles redirects through the return directive, which is more performant than rewrite for simple URL redirects because it does not invoke the regex engine.
server {
listen 80;
server_name example.com;
location = /old-page {
return 302 https://example.com/new-page;
}
}For pattern-based temporary redirects:
server {
listen 443 ssl;
server_name example.com;
location ~* ^/promo/(.+)$ {
return 302 https://example.com/campaigns/$1;
}
}After editing the configuration, always test syntax before reloading:
sudo nginx -t && sudo systemctl reload nginxSkipping nginx -t is a common cause of service outages β a syntax error in the config file will prevent Nginx from reloading and may cause it to fail on the next restart.
On a VPS Hosting environment where you have full root access, you can place these directives directly in /etc/nginx/sites-available/your-site.conf and symlink it to sites-enabled/.
PHP: Header-Based Redirect
For application-level redirects where server configuration access is limited, PHP's header() function provides a reliable mechanism. This must be called before any output is sent to the browser β including whitespace before the opening <?php tag.
<?php
header("Location: https://example.com/new-page", true, 302);
exit();The exit() call is mandatory. Without it, PHP continues executing the remainder of the script, which can expose partial page content, trigger database queries unnecessarily, or create security vulnerabilities if the script performs privileged operations after the redirect.
Framework note: In Laravel, use return redirect()->to('/new-page', 302);. In Symfony, use return new RedirectResponse('/new-page', 302);. In WordPress outside of plugins, use wp_redirect( $url, 302 ); exit;.
WordPress: Plugin-Based Management
For WordPress sites, manual file editing is not always practical or safe, particularly on managed environments. The Redirection plugin (by John Godley) is the most widely used solution and provides a full redirect log, conditional redirect rules, and import/export functionality.
Setup workflow:
- Install and activate the Redirection plugin from the WordPress plugin repository.
- Navigate to Tools > Redirection.
- Under the Redirects tab, click Add New.
- Enter the source URL (e.g.,
/old-page) and target URL (e.g.,https://example.com/new-page). - Set the HTTP Code to
302. - Save and verify using the built-in redirect checker.
On a VPS with cPanel environment, you can also manage redirects directly through cPanel's Redirects interface under the Domains section, which writes the appropriate .htaccess rules automatically.
JavaScript: Client-Side Redirect (Use Only as Last Resort)
JavaScript redirects are not HTTP redirects. They execute after the page has partially loaded in the browser and are invisible to server-side crawlers unless JavaScript rendering is explicitly supported.
window.location.replace("https://example.com/new-page");replace() is preferable to assign() for redirect scenarios because it does not add the source URL to the browser history, preventing users from navigating back to a page that should not be accessible.
When this is acceptable: Client-side single-page applications (SPAs) where routing is entirely managed in JavaScript, or as a fallback for environments where server-side configuration is completely inaccessible. Never use JavaScript redirects as a substitute for server-side 302s in SEO-sensitive contexts.
SEO Mechanics: What Actually Happens When Googlebot Hits a 302
Understanding the crawler's behavior at a technical level prevents costly misconfigurations.
When Googlebot encounters a 302, it:
- Records the original URL as the canonical URL and continues indexing it.
- Follows the redirect to the destination URL and crawls it as well.
- Does not consolidate PageRank or link signals from the original to the destination.
- Revisits the original URL on its normal crawl schedule to check whether the redirect is still in place.
The 302 hijacking vulnerability: In the early 2000s, malicious actors exploited 302 redirects to temporarily redirect high-authority pages to their own content, effectively borrowing ranking signals. Google's algorithms have since been hardened against this, but it illustrates why the engine treats 302 destinations with reduced trust.
Redirect chain compounding: A 302 that points to a URL which itself issues another redirect (301 or 302) creates a redirect chain. Each hop adds latency (~100β300ms per hop depending on server geography) and dilutes crawl budget. Keep chains to a maximum of one hop. Use Dedicated Servers for high-traffic sites where redirect latency compounds across millions of daily requests.
Cache-Control interaction: Browsers may cache 302 responses if the response includes a Cache-Control: max-age or Expires header. This is rarely intentional for temporary redirects. Explicitly set Cache-Control: no-store on 302 responses to prevent browsers from caching a redirect that you intend to remove.
location = /promo {
add_header Cache-Control "no-store";
return 302 https://example.com/summer-sale;
}Verifying That Your 302 Redirect Is Working Correctly
Using curl on the Command Line
The most reliable verification method for server administrators is a direct HTTP request with verbose headers:
curl -I -L https://example.com/old-pageThe -I flag requests headers only, and -L follows the redirect chain. Look for HTTP/2 302 (or HTTP/1.1 302 Found) in the first response block, followed by the Location: header pointing to the destination.
To inspect the full chain without following it:
curl -I --max-redirs 0 https://example.com/old-pageUsing Google Search Console
In Search Console, the URL Inspection tool shows how Googlebot last crawled a URL, including any redirect it encountered. If a 302 has been in place for an extended period and Google has started treating it as permanent (indexing the destination instead of the source), this tool will surface that behavior.
Using Screaming Frog SEO Spider
Screaming Frog's crawler identifies all redirect types across a full site crawl, flags redirect chains, and exports a complete redirect map. This is the standard tool for pre-launch redirect audits and post-migration verification.
Using Browser Developer Tools
In Chrome or Firefox, open DevTools (F12), navigate to the Network tab, disable cache (Ctrl+Shift+R for a hard reload), and inspect the first request. The Status column will show 302 and the Location response header will display the destination URL.
Common Pitfalls and How to Avoid Them
Using 302 when you mean 301: The most frequent error. If a page has been permanently retired or merged into another URL, a 302 will prevent link equity consolidation indefinitely. Audit your redirect inventory quarterly.
Forgetting to remove temporary 302s: Set calendar reminders when deploying a 302 for a campaign or maintenance window. Orphaned 302 redirects accumulate over time and create crawl budget waste and user confusion.
Redirect loops: A redirects to B, B redirects back to A. This crashes the browser with a "Too many redirects" error and prevents Googlebot from crawling either URL. Always test new redirects with curl before deploying to production.
Redirecting the entire site during maintenance instead of specific pages: A site-wide 302 to a maintenance page signals to search engines that every URL on the site has temporarily moved. For maintenance scenarios, a 503 Service Unavailable with a Retry-After header is more semantically correct for full-site downtime.
Applying 302s to paginated content: Redirecting /page/2 to /page/1 during a content reorganization using a 302 can cause duplicate content signals. Use canonical tags alongside or instead of redirects for pagination management.
If you are managing SSL termination alongside redirects, ensure your redirect rules fire on the correct listener. A 302 configured on port 80 that redirects to an HTTPS URL should not conflict with your HTTPS-to-HTTP redirect rules. Proper SSL Certificates configuration is a prerequisite for clean redirect chains on HTTPS sites.
For sites hosted on Shared Web Hosting, redirect management is typically handled through .htaccess or the hosting control panel's redirect interface, since direct Nginx or Apache configuration file access is usually restricted.
Decision Matrix: 302 vs. Other Redirect Types
Use this matrix to select the correct redirect type for your specific scenario:
| Scenario | Correct Redirect | Reasoning |
|---|
| ———- | —————– | ———– |
|---|
| Permanent URL migration (page moved forever) | 301 | Passes link equity to new URL |
|---|
| Temporary maintenance page | 302 | Original URL stays indexed |
|---|
| A/B test variant page | 302 | Preserves canonical URL authority |
|---|
| Seasonal promotion landing page | 302 | Removed after campaign ends |
|---|
| POST form submission redirect | 303 | Prevents form resubmission on back |
|---|
| Temporary API endpoint redirect (preserve method) | 307 | Method preservation required |
|---|
| Permanent API endpoint redirect (preserve method) | 308 | Method preservation + permanent |
|---|
| Full-site downtime | 503 + Retry-After | Not a redirect; signals temporary unavailability |
|---|
| Geolocation routing | 302 | Original URL remains canonical |
|---|
| Login wall redirect | 302 | Resource accessible post-authentication |
|---|
Technical Key-Takeaway Checklist
- Confirm the redirect is genuinely temporary before choosing 302 over 301.
- Set
Cache-Control: no-storeon 302 responses to prevent unintended browser caching. - Use
curl -Ito verify the correct status code andLocationheader before pushing to production. - Audit redirect chains β keep them to a single hop maximum.
- Add
Retry-Afterheaders when using 302 for maintenance-related redirects. - Use 307 instead of 302 when the original HTTP method (POST, PUT, PATCH) must be preserved.
- Remove temporary 302 redirects on a defined schedule; set reminders at deployment time.
- Monitor redirect-affected URLs in Google Search Console's URL Inspection tool monthly.
- For WordPress environments, use the Redirection plugin with logging enabled to track redirect hit counts and identify orphaned rules.
- Never use JavaScript redirects in place of server-side 302s for SEO-critical pages.
Frequently Asked Questions
Does a 302 redirect pass any PageRank or link equity to the destination URL?
No. Google treats 302 as a temporary signal and retains all ranking authority on the original URL. Link equity is only transferred via 301 (or 308) permanent redirects.
How long can a 302 redirect stay in place before Google treats it as permanent?
There is no hard-coded threshold, but Google's John Mueller has indicated that redirects in place for several months may begin to be treated as permanent. Practically, any 302 older than 90 days should be reviewed and converted to a 301 if the move is no longer temporary.
What is the difference between a 302 and a 307 redirect?
Both are temporary redirects, but a 302 allows the browser to change the HTTP method to GET when following the redirect (legacy behavior), while a 307 strictly preserves the original HTTP method. Use 307 for API endpoints or form submissions where method preservation is required.
Can a 302 redirect cause a redirect loop, and how do I fix it?
Yes. A loop occurs when URL A redirects to URL B, which redirects back to A (or through a chain that returns to A). Fix it by auditing your redirect rules with curl --max-redirs 0 on each URL in the suspected chain, then removing or correcting the conflicting rule. Screaming Frog's redirect chain report automates this detection across an entire site.
Should I use a 302 redirect or a <meta> refresh tag for temporary redirects?
Always use a server-side 302 redirect. Meta refresh tags execute client-side after the page begins loading, are not processed reliably by all crawlers, and add unnecessary page load latency. They are an acceptable last resort only when server-side configuration access is completely unavailable.
