301 Moved Permanently: The SEOβFriendly Redirect
When to Use 301
- Domain migration β moving from old-domain.com to new-domain.com.
- URL structure change β e.g., from
/product?id=123to/products/widget. - HTTP to HTTPS β redirecting insecure HTTP traffic to secure HTTPS.
- Consolidating multiple pages β merging several similar pages into one.
- Removing obsolete content β when you delete a page and want to redirect to the most relevant alternative.
Example Response
Method Handling: POST β GET
One important behavior of 301 (and 302) is that the request method may change from POST to GET. If a client submits a POST request to a URL that returns 301, the client will typically resend the request as a GET to the new location, discarding the body. This is why 301 is not ideal for form submissions where the data must be preserved.
If you need to preserve the method, use 307 Temporary Redirect or 308 Permanent Redirect instead.
301 vs. Other Redirects
| Status | Permanent? | Method Change? | Use Case |
|---|---|---|---|
| 301 | β Yes | POST β GET | SEOβfriendly permanent moves. |
| 302 | β No | POST β GET | Temporary moves (legacy). |
| 303 | β No | Always GET | After POST to show a different page. |
| 307 | β No | β No (method preserved) | Temporary redirect with same method. |
| 308 | β Yes | β No (method preserved) | Permanent redirect with same method. |
SEO Considerations
- Link equity transfer β Google transfers PageRank and ranking signals from the old URL to the new one, but there may be a slight loss (around 15% according to some studies).
- Update sitemap β after setting up 301s, update your XML sitemap to point to the new URLs.
- Avoid redirect chains β redirect A β B β C is worse than A β C. Each hop loses some link equity.
- Use 301s sparingly β only for permanent moves. For temporary changes, use 302 or 307.
- Cache control β 301 responses are cached by browsers and proxies, which can cause issues if you later need to undo the redirect.
Implementing a 301 Redirect
Apache (.htaccess):
Nginx:
return 301 https://example.com/new-page;
}
Cloudflare (Page Rules):
Frequently Asked Questions
Does a 301 redirect affect SEO?
Yes, 301 redirects transfer most of the link equity (PageRank) from the old URL to the new one. However, there is a small loss (usually around 10-15%), so try to keep redirects to a minimum.
Can I use 301 for HTTPS?
Yes, using a 301 redirect from HTTP to HTTPS is recommended. It tells browsers and search engines that the secure version is the canonical one.
What's the difference between 301 and 308?
Both are permanent redirects. 301 may change the request method from POST to GET. 308 guarantees that the method and body are preserved. Use 301 for GET requests and 308 for POST/PUT requests where you need to keep the data.