301 vs 307: Why Your Redirect Type Matters More Than You Think
Not all redirects are the same. 301 means permanent. 307 means temporary. Pick the wrong one and you lose SEO, break forms, or confuse browsers. Here's what each one actually does.

Two redirects. Same destination. Very different results.
You want oldsite.com/page to go to newsite.com/page.
You set up a redirect. It works. You test it in your browser. Everything seems fine.
But months later, your SEO is worse. Or a form stopped working. Or Google is showing the wrong URL in search results.
You forgot to pick the right redirect type.
301 and 307 both send users from one URL to another. But browsers and search engines treat them very differently. One is for permanent moves. One is for temporary changes.
Use the wrong one, and you pay the price months later.
Let me explain exactly what each one does and when to use them.
What Happens When You Redirect
Before we compare, let's understand the basics.
When you visit a URL, your browser sends a request to the server. The server responds with a status code.
200 OKmeans "here's the page"404 Not Foundmeans "this page doesn't exist"301 Moved Permanentlymeans "this URL has moved forever, go here instead"307 Temporary Redirectmeans "this URL has moved for now, go here instead but keep checking back"
The status code tells the browser (and search engines) how to treat the redirect.
The redirect also includes a Location header with the new address.
301 Moved Permanently
What it means: "This URL is dead forever. The new URL is the real one now. Update your records."
What browsers do: Cache the redirect. The next time someone tries the old URL, the browser doesn't even ask the server. It goes straight to the new address. This makes future requests faster.
What search engines do: Transfer all link equity (SEO value) from the old URL to the new one. Remove the old URL from search results. Index the new URL in its place.
When to use 301:
| Scenario | Example |
|---|---|
| Domain change | oldsite.com → newsite.com |
| HTTP to HTTPS | http://example.com → https://example.com |
| www to non-www | www.example.com → example.com |
| Page moved permanently | example.com/old-page → example.com/new-page |
| Deleted page | example.com/discontinued-product → example.com/similar-product |
| URL structure change | example.com/category/post → example.com/post |
Example response:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Content-Length: 0
Once a browser or search engine sees this, it updates its records. The old URL is gone.
307 Temporary Redirect
What it means: "This URL is temporarily at a different location. But don't update your records. Keep checking the old URL because it might come back."
What browsers do: Follow the redirect now. But they do NOT cache it. Next time someone visits the old URL, the browser asks the server again. It doesn't assume the redirect is still valid.
What search engines do: Keep the old URL in search results. Do NOT transfer link equity to the new URL. Treat the redirect as a temporary situation.
When to use 307:
| Scenario | Example |
|---|---|
| Site maintenance | example.com → example.com/maintenance |
| A/B testing | example.com → example.com/variant-b (for some users) |
| Temporary content move | Moving a page for a few days, then moving it back |
| Post-login redirect | After form submission, redirect to confirmation page |
| Service temporarily unavailable | API endpoint temporarily moved |
Example response:
HTTP/1.1 307 Temporary Redirect
Location: https://example.com/maintenance
Content-Length: 0
Browsers and search engines follow the redirect, but they don't treat it as permanent.
The Critical Difference: Caching
This is the most important difference.
301: Browsers cache the redirect. Forever (or until the cache expires). If you ever need to undo a 301 redirect, you have to wait for all caches to clear. That can take weeks or months.
307: Browsers don't cache the redirect. Every time someone visits the old URL, the browser checks the server. If you remove the redirect, it stops working immediately.
Why this matters:
If you set up a 301 redirect by accident (or for a temporary situation), you're stuck. Changing it back takes time because browsers and search engines have already cached the redirect.
If you set up a 307 redirect for a permanent move, you lose SEO value and your old URL stays in search results forever.
Pick the right one the first time.
The Other Critical Difference: Request Methods
This is where 307 shines.
Different types of requests:
GET– normal page request (clicking a link, typing a URL)POST– submitting a form (login, checkout, search)
With a 301 redirect: Most browsers change a POST request into a GET request. The form data disappears. The submission fails.
With a 307 redirect: Browsers preserve the request method. If the original request was POST, the redirect also uses POST. The form data stays intact.
Real example:
You submit a payment form. The form sends a POST request to example.com/pay.
The server needs to redirect you to example.com/confirmation.
- If you use
301, the browser changesPOSTtoGET. The payment data disappears. The confirmation page has no idea what you paid for. - If you use
307, the browser keepsPOST. The payment data is preserved. The confirmation page works correctly.
For forms and logins, use 307.
Comparison Table
| 301 Permanent | 307 Temporary | |
|---|---|---|
| Meaning | Moved forever | Moved for now |
| Browser caches? | Yes | No |
| SEO value transferred? | Yes | No |
| Old URL leaves search? | Yes | No |
| Preserves POST method? | No (usually changes to GET) | Yes |
| Good for permanent moves? | ✅ Yes | ❌ No |
| Good for temporary moves? | ❌ No | ✅ Yes |
| Good for form submissions? | ❌ No (data lost) | ✅ Yes (data preserved) |
| Can you undo it easily? | No (cached everywhere) | Yes (no cache) |
Real Examples
Example 1: You changed your domain.
Old: oldsite.com/about
New: newsite.com/about
This is permanent. Use 301. You want search engines to transfer SEO value. You want the old URLs gone from search results.
Example 2: Your site is down for maintenance.
You want all traffic to go to example.com/maintenance for two hours.
This is temporary. Use 307. You don't want browsers to cache the redirect. After two hours, you remove the redirect. Everything goes back to normal.
Example 3: You submit a login form.
Form submits to example.com/login. After successful login, you redirect to example.com/dashboard.
Use 307. You need to preserve the POST data (username, password). If you use 301, the login fails.
Example 4: You moved a blog post to a new URL.
Old: example.com/2020/post-title
New: example.com/blog/post-title
This is permanent. Use 301. You want anyone who clicks the old link (from social media, emails, other sites) to end up at the new post. You want search engines to update their index.
Example 5: You're A/B testing a homepage.
50% of users see version A. 50% see version B. You use temporary redirects to send users to different URLs.
Use 307. This is temporary. You don't want search engines to index the variant URLs. You don't want browsers to cache the redirect.
The One You Should Avoid: 302
302 Found was the original temporary redirect. But browsers implemented it inconsistently.
- Some browsers preserved the request method (like 307)
- Some changed POST to GET (like 301)
- Some cached the redirect
- Some didn't
Because of this inconsistency, HTTP/1.1 introduced 307 to replace 302 for temporary redirects that need to preserve the request method.
Rule: Don't use 302. Use 301 for permanent. Use 307 for temporary.
How to Check What Redirect You're Using
Open your terminal. Run:
curl -I https://example.com/old-page
Look at the first line of the response.
HTTP/1.1 301 Moved Permanently
or
HTTP/1.1 307 Temporary Redirect
That's your redirect type.
If you don't see a redirect at all, the server is serving content directly.
Common Mistakes
Mistake #1: Using 307 for a permanent domain change
Result: Old domain stays in search results. No SEO value transfers. Two versions of your site compete in Google.
Fix: Change to 301.
Mistake #2: Using 301 for a temporary maintenance page
Result: After maintenance ends, browsers still have the redirect cached. Users keep getting sent to the maintenance page for days or weeks.
Fix: Use 307 for anything temporary.
Mistake #3: Using 301 for a form redirect
Result: Form data disappears. Login fails. Checkout breaks.
Fix: Use 307 for any redirect that follows a POST request.
The Bottom Line
| Use 301 when... | Use 307 when... |
|---|---|
| URL moved forever | URL moved temporarily |
| Domain or site structure changed | Site is in maintenance mode |
| You want SEO value transferred | You don't want SEO value transferred |
| You want old URL removed from search | You want old URL to stay in search |
| Page is deleted or replaced | You're A/B testing |
| HTTP to HTTPS | Form submission or login redirect |
Most of your redirects will be 301. Permanent moves are more common than temporary ones.
But when you need temporary, use 307. Not 302. Not 301. 307.
One Final Rule
If you can't answer "how long will this redirect last?" — use 301.
Permanent redirects are safer for SEO and user experience. Temporary redirects should be explicitly temporary.
When in doubt, 301.
Written by Fredsazy — because the right status code saves months of cleanup.

Iria Fredrick Victor
Iria Fredrick Victor(aka Fredsazy) is a software developer, DevOps engineer, and entrepreneur. He writes about technology and business—drawing from his experience building systems, managing infrastructure, and shipping products. His work is guided by one question: "What actually works?" Instead of recycling news, Fredsazy tests tools, analyzes research, runs experiments, and shares the results—including the failures. His readers get actionable frameworks backed by real engineering experience, not theory.
Share this article:
Related posts
More from Software
April 28, 2026
4Burnout, anxiety, exhaustion. Developer mental health is worse than most people realize. Here's why it matters and what you can actually do about it.

April 28, 2026
3Google dominates search for a reason. Here's what makes it better for ranking than Bing, DuckDuckGo, or anyone else.

April 28, 2026
5Submitted your site to Google and nothing happened? Here are the actual things that help Google find and index your pages faster — no magic, just best practices.
