301 Moved Permanently
This status code indicates that the requested resource has been permanently moved to a new URL. It is recommended to use this status code when you want to permanently redirect a page to a new location.
302 Found
This status code indicates that the requested resource has been temporarily moved to a new location. It is commonly used for short-term redirects, and the client should continue to use the original URL in the future.
304 Not Modified
This status code indicates that the requested resource has not been modified since the last time the client accessed it. It is commonly used to reduce server load and improve performance by instructing the client to use a cached version of the resource.
307 Temporary Redirect
This status code is similar to 302 Found but explicitly indicates that the redirect is temporary.
308 Permanent Redirect
This status code is similar to 301 Moved Permanently but explicitly indicates that the redirect is permanent.
3xx response codes should be used when you need to redirect a page or resource to a different location, either temporarily or permanently. Some common scenarios when you might use 3xx response codes include:
- Moving a page to a new URL or domain
- Changing the structure of a website and redirecting old URLs to new ones
- Creating a temporary maintenance page to inform users of downtime
- Redirecting traffic to a different server for load balancing or failover purposes.