When to use 301 and 302
- 301 (permanent): the page has moved for good: a new URL structure, a merged page, a domain change. Search engines move ranking signals to the new URL and eventually drop the old one.
- 302 (temporary): the old URL will come back: a seasonal page, A/B test or maintenance. Search engines keep the original URL indexed.
Point every old URL straight at its final destination. Chains (A → B → C) slow visitors down and waste crawl budget. The full comparison is in 301 vs 302 redirects.
Frequently asked questions
Where do I put .htaccess redirects?
In the .htaccess file in your site’s document root (often public_html) on an Apache or LiteSpeed server, which most shared hosts use. Put redirect rules near the top, before any CMS rules such as the WordPress block, and keep a backup: a typo can take the whole site down with a 500 error.
Which servers use the _redirects file?
Netlify and Cloudflare Pages read a plain _redirects file from the root of your published folder. Vercel uses a redirects list in vercel.json instead, and Nginx needs rules in the server configuration.
Should I redirect to the www or non-www version?
Either is fine for SEO. What matters is choosing one, redirecting the other to it with a 301, and using it consistently in canonical tags, sitemaps and internal links.
How do I check a redirect works?
Open the old URL in a private window, or run curl -I https://example.com/old-page in a terminal. You should see a 301 status and a Location header pointing to the new URL, with no chain of several redirects in a row.