HTTP Common Errors and Debugging/301 vs 302 vs 307 vs 308

Choose the right redirect semantics.

Section: Common Web Error Scenarios

301 vs 302 vs 307 vs 308

text
text
301 = permanent
302 = temporary
307 = temporary, preserve method
308 = permanent, preserve method
Explanation

`307` and `308` are often better for APIs when method preservation matters.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Common Web Error Scenarios
401 vs 403
Authentication versus authorization.
OpenIn sheettextsame section
404 vs 410
Missing resource versus intentionally removed resource.
OpenIn sheettextsame section
502 vs 503 vs 504
Gateway and availability failures.
OpenIn sheettextsame section
Cache validation codes
Conditional request and cache-related statuses.
OpenIn sheettextsame section
Print only the status code
Useful for scripts and health checks.
Print redirect target
Show the redirect location without fully following it.