Need DNS hosting? Anycast nameservers, free wildcard SSL, email forwards and an API — free for up to 5 zones on urlpath DNS. Take a look →

301 vs 302 redirects: which one to use and when

Every redirect carries a status code, and the two you'll use almost always are 301 (permanent) and 302 (temporary). The difference is one word, but it changes how browsers cache the link and how search engines treat the destination.

301 — "this moved for good"

  • Tells search engines to consolidate the old URL's ranking signals into the new one.
  • Browsers are allowed to cache it aggressively — a visitor may not hit your server again for that link.
  • Right for: rebrands, retired pages, merged sites, permanent short links on your brand.

302 — "this moved for now"

  • Tells everyone the change is temporary: the old URL keeps its own identity.
  • Browsers re-check the link instead of caching forever.
  • Right for: campaigns and seasonal promos, A/B tests, maintenance detours, rotating offers behind one printed link.

Rules of thumb

  • Not sure? Use 302. It's the reversible choice. You can promote a link to 301 later once you're sure it's permanent.
  • Don't 301 an experiment. A cached permanent redirect is hard to walk back for visitors who already stored it.
  • Paused beats deleted. If a link needs to stop working temporarily, pause it — the URL and its history stay intact.

301, 302, 307 and 308 side by side

CodeMeaningSEO effectWhen to useBrowser caching
301Moved permanentlyPasses most ranking signals to the new URLRebrands, retired pages, permanent linksCan be cached aggressively
302Found (temporary)The original URL usually stays indexedCampaigns, tests, maintenance detoursRe-checked, not cached forever
307Temporary, same methodTreated like 302A temporary move where a POST form must keep its methodRe-checked, like 302
308Permanent, same methodTreated like 301A permanent move where a POST form must keep its methodCan be cached, like 301

307 and 308 are the versions of 302 and 301 that keep the request method. A browser that follows a 301 or 302 may switch a POST to a GET. A 307 or 308 keeps the POST.

Code examples

Here is how to send each code from PHP, the language this site runs on. Put the redirect before any output.

// 301: permanent move
header('Location: https://www.example.com/new-page', true, 301);
exit;

// 302: temporary move
header('Location: https://www.example.com/this-week', true, 302);
exit;

// 307: temporary, keep the request method
header('Location: https://www.example.com/checkout-v2', true, 307);
exit;

// 308: permanent, keep the request method
header('Location: https://www.example.com/checkout', true, 308);
exit;

Frequently asked questions

Does a 301 redirect pass link value?

A 301 tells search engines the move is permanent, so they consolidate the old URL's ranking signals into the new one.

When should I use a 302?

Use a 302 when the move is temporary, such as a campaign, an A/B test or a maintenance page. If you are not sure, use a 302. You can change it to a 301 later.

What is the difference between 307 and 302?

Both are temporary. A 307 keeps the request method, so a POST stays a POST. A 302 lets browsers switch it to a GET.

Can I switch between 301 and 302 without breaking links?

Yes. In urlpath.cloud, change the redirect's status in the dashboard. The change applies right away.

Switching in urlpath.cloud

Every redirect in the dashboard has a 301/302 switch you can flip at any time — the change applies immediately, no DNS or certificate work involved. Combined with schedules (go live and expire automatically) and A/B splits for testing destinations, you can run a link's whole lifecycle — temporary first, permanent when you're sure — without ever breaking the URL you already handed out.

Keep reading

Put your domains to work More in Resources