When you need redirects
Any time a URL changes: a renamed page, a new blog structure, a merged product, a move to a new domain. Without a redirect, old links and search results hit a 404 and the authority those links earned is lost. With a permanent redirect, visitors and search engines land on the new page and most of that value carries over.
Which status code
- 301 Moved Permanently. The default for SEO. The old URL is gone for good; search engines replace it with the new one.
- 308 Permanent Redirect. Same meaning as 301, but the request method is kept, so a POST stays a POST. Vercel and Next.js use it for permanent redirects.
- 302 Found. Temporary. Search engines keep the old URL indexed. Use it for short promotions or A/B tests.
- 307 Temporary Redirect. Temporary, and keeps the method.
For a page that has moved, use 301 or 308. Google treats them the same.
Per host
- Apache reads
.htaccesswith mod_rewrite. Rules go near the top, before any framework rewrites. - Nginx uses exact
location =blocks inside yourserverblock. Reload Nginx after editing. - Cloudflare Pages and Netlify read a
_redirectsfile in the build output:/from /to 301. - Vercel reads a
redirectsarray invercel.json. - Next.js returns the array from
redirects()innext.config.js.
Avoid chains and loops
Point every old URL straight at its final destination. A redirect to a page that itself redirects slows visitors down and leaks value; a loop breaks the page entirely. After deploying, test a few old URLs with the redirect checker, then update internal links and your sitemap to use the new URLs directly.