301 Moved Permanently
Redirect - Resource has moved to a new URL permanently
HTTP 301 Moved Permanently
What It Means
The HTTP 301 Moved Permanently status code indicates that the requested resource has been permanently moved to a new URL. Clients should update their bookmarks and search engines will transfer SEO value to the new URL.
SEO Impact
PageRank Transfer
301 redirects pass approximately 90-99% of link equity (PageRank) to the new URL. Search engines treat the new URL as the canonical version.
When to Use 301
- Domain changes: Moving from old-domain.com to new-domain.com
- URL restructuring: Changing /blog/post-123 to /articles/post-title
- HTTPS migration: Redirecting HTTP to HTTPS
- Merging content: Combining duplicate pages
- www normalization: Redirecting www to non-www (or vice versa)
Example Response
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Content-Type: text/html
<html>
<body>
This page has moved to
<a href="https://example.com/new-page">here</a>.
</body>
</html>
301 vs 302 vs 308
| Code | Type | SEO |
|---|---|---|
| 301 | Permanent, may change method | Passes link equity |
| 302 | Temporary | Keeps original indexed |
| 308 | Permanent, preserves method | Passes link equity |
Implementation Examples
Nginx
server {
listen 80;
server_name old-domain.com;
return 301 https://new-domain.com$request_uri;
}
Apache (.htaccess)
Redirect 301 /old-page https://example.com/new-page
Next.js
// next.config.js
module.exports = {
async redirects() {
return [
{
source: '/old-page',
destination: '/new-page',
permanent: true, // 301
},
]
},
}
Common Mistakes
- Redirect chains: A → B → C. Keep it to one hop
- Redirect loops: A → B → A causes infinite loops
- Using 301 for temporary changes: Use 302 instead
- Not updating internal links: Fix links, don't rely on redirects