What 302 Found Means
A 302 Found response tells the client that the resource is temporarily at another address, given in the Location header. The browser follows it at once, and the visitor rarely notices. The key word is temporarily: the client should keep using the original address next time. A login page that sends you back to where you were, a seasonal landing page, and a site in maintenance all use 302.
HTTP/1.1 302 Found
Location: https://example.com/winter-sale301 vs 302
- 301 Moved Permanently: the old address is retired. Browsers may cache the redirect, and search engines move the old page's signals to the new address and show the new one in results.
- 302 Found: the move is temporary. Browsers do not cache it unless headers say so, and search engines tend to keep the original address in their index.
Use 301 when you change a domain, move from HTTP to HTTPS, or rename a page for good. Use 302 when the original address will come back.
All Redirect Codes Compared
| Code | Meaning | Method when followed |
|---|---|---|
| 301 | Moved permanently | POST may become GET |
| 302 | Found, temporary | POST may become GET |
| 303 | See other | Changed to GET |
| 307 | Temporary | Kept |
| 308 | Permanent | Kept |
The difference between 302 and 307 is the method. After a form POST, browsers repeat a 302 as a GET in practice, although the original standard did not intend it; 307 was added to state plainly that the method and body must be kept. 303 is meant for "the form was accepted, now load this result page" and keeps a reload from sending the form twice. 308 is the permanent form of 307, useful for API addresses that receive POST.
Search Engines and Caching
- Permanent redirects: 301 and 308 tell search engines to replace the old address with the new one. A 302 left in place for months may in the end be treated much like a permanent one, but the signal is weaker and slower.
- Browser cache: browsers can store a 301 or 308 without any cache header, sometimes for a long time. A wrong permanent redirect is hard to take back for visitors who have already seen it, so test new redirects as 302 and change them to 301 once they are right.
- Chains: each extra hop costs a round trip. Point old addresses straight to the final one.
Redirects in Nginx
location = /sale {
return 302 https://example.com/winter-sale;
}
location = /old-page {
return 301 https://example.com/new-page;
}A rewrite line can redirect too: its redirect flag gives 302 and its permanent flag gives 301. return is clearer when the target is fixed. Test and reload with sudo nginx -t && sudo systemctl reload nginx. The HTTPS case is in how to redirect HTTP to HTTPS in Nginx.
Redirects in Apache
Redirect 302 /sale https://example.com/winter-sale
Redirect 301 /old-page https://example.com/new-pageRedirect without a status gives 302, so write the code out. With mod_[R=301,L] for a permanent redirect. Both forms work in a virtual host or in an .htaccess file; see Apache mod_
Check a Redirect with curl
curl -I https://example.com/old-page
curl -sIL https://example.com/old-page | grep -i -E '^(HTTP|location)'The first command shows the status and the Location header of one hop. The second follows every hop with -L and prints only the status lines and targets, so a chain or a wrong code is visible at once. curl keeps no cache, so it shows what the server sends now, even when a browser still remembers an old 301.
Redirect Loops
When two rules send a visitor back and forth, the browser stops after a number of hops and shows a too many redirects error. The usual causes are an HTTPS redirect behind a proxy or CDN that connects to the server over plain HTTP, and www and non-www rules that contradict each other. The second curl command above shows the loop; the fixes are in ERR_
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations