HTTP Redirects: The Complete Reference Guide
Understanding 301, 302, 307, 308 and every redirect status code
Alex Chen — Principal Engineer

HTTP redirects are one of the most fundamental mechanisms on the web. They tell browsers and search engines that a resource has moved from one URL to another. While the concept is simple, the details are surprisingly nuanced — different redirect types have different implications for SEO, caching, browser behavior, and user experience. This guide covers everything you need to know about HTTP redirects, from the basic 301/302 distinction to the subtleties of 307/308 and meta refresh alternatives.
Redirect Status Codes Explained
The HTTP specification defines several redirect status codes in the 3xx range. 301 Moved Permanently indicates that the resource has permanently moved to a new URL. Browsers cache this redirect, and search engines transfer link equity to the new URL. 302 Found indicates a temporary redirect — the resource is currently at a different URL but may return to the original. Browsers do not cache it, and search engines typically keep the original URL in their index. 303 See Other directs the client to a different URL using a GET request, typically used after form submissions. 307 Temporary Redirect is the HTTP/1.1 equivalent of 302, with the important distinction that it preserves the HTTP method (a POST request stays a POST). 308 Permanent Redirect is the HTTP/1.1 equivalent of 301, also preserving the HTTP method.
301 vs 302: The SEO Impact
The 301 vs 302 distinction is perhaps the most consequential redirect decision for SEO. A 301 redirect passes approximately 90-99% of link equity to the destination URL and signals to search engines that the original URL should be replaced in their index. A 302 redirect passes little to no link equity and tells search engines to keep the original URL indexed. This distinction matters enormously: using a 302 when you should use a 301 can prevent your new URL from ranking, while using a 301 when you should use a 302 can cause search engines to drop your original URL from their index.
Redirect Chains and Loops
A redirect chain occurs when URL A redirects to URL B, which redirects to URL C. Each hop in the chain adds latency and can reduce the link equity passed to the final destination. Google has stated that they follow up to 10 redirect hops, but each additional hop degrades the signal. Best practice is to ensure your redirects go directly from the source to the final destination in a single hop. A redirect loop occurs when URL A redirects to URL B, which redirects back to URL A, creating an infinite loop. Browsers detect and break redirect loops after a certain number of hops, but loops waste server resources and provide a terrible user experience.
Redirects and Caching
Different redirect types have different caching behaviors. 301 redirects are cached by browsers, which means subsequent visits to the original URL will not even hit your server — the browser will automatically navigate to the cached destination. This is great for performance but means you cannot easily change a 301 redirect after it has been cached. 302, 307, and 308 redirects are not cached by default, giving you more flexibility. If you need a 301 redirect to be updateable, you can control caching with Cache-Control and Expires headers, though this reduces the performance benefit.
Redirects in URL Shorteners
URL shorteners rely heavily on redirects, and the choice of redirect type has significant implications. At yas.sh, we use 301 redirects by default for several reasons: they preserve SEO equity by passing link authority to the destination URL, they are cached by browsers improving performance for repeat visitors, and they signal to search engines that the short URL is not the canonical content location. For users who need click-level tracking on every visit (including repeat visits from the same browser), we offer 302 redirect configuration as an option.
Server-Side Redirect Implementation
Implementing redirects correctly depends on your server technology. In Nginx, use the return directive for simple redirects and the rewrite directive for pattern-based redirects. In Apache, use the Redirect and RedirectMatch directives in .htaccess or server configuration. In Node.js/Express, use the res.redirect() method. In Next.js, use the redirects array in next.config.js or the redirect() function in server components. Regardless of technology, always test your redirects with tools like cURL, browser developer tools, and redirect checkers to ensure they return the correct status code and destination.
Conclusion
HTTP redirects are a powerful but nuanced tool. Understanding the differences between redirect types, their SEO implications, caching behaviors, and proper implementation is essential for every web developer and SEO professional. When used correctly, redirects ensure that users and search engines always reach the right content, regardless of which URL they start from.