301 Moved Permanently
The target resource has been assigned a new permanent URI.
Usually happens because:
- ☑ Changing site domains or URL
- ☑ Redirecting non-WWW links to WWW
- ☑ Forcing HTTP connections to upgrade
🔍 Quick Checklist:
Meaning
The HTTP 301 Moved Permanently redirect status code indicates that the resource requested has been permanently moved to the URL given by the Location headers. Browser clients cache this redirect automatically, updating local bookmarks.
Root Causes
- Changing site domains or URL structures permanently.
- Redirecting non-WWW links to WWW domains (or vice-versa).
- Forcing HTTP connections to upgrade to secure HTTPS channels.
| Cause | Frequency |
|---|---|
| Changing site domains or URL | ⭐⭐⭐⭐⭐ |
| Redirecting non-WWW links to WWW | ⭐⭐⭐⭐ |
| Forcing HTTP connections to upgrade | ⭐⭐⭐ |
Common Mistakes
- Using 301 for temporary redirects (since browsers cache 301s permanently, removing them is extremely difficult).
- Creating infinite redirect loops (e.g., page A redirects to B, and B redirects back to A).
How to Fix
Framework-Specific Examples
Express route redirecting permanently to a new path.
app.get('/old-path', (req, res) => {
res.redirect(301, '/new-path');
});Server Configuration Examples
Enforcing permanent HTTPS upgrades inside server blocks.
server {
listen 80;
return 301 https://$host$request_uri;
}Prevention
- Only use 301 when you are absolutely sure the old URL will never be reused.
- Clear local browser cache when debugging redirect loops.
Frequently Asked Questions (FAQ)
Q: Is HTTP 301 cacheable by browsers?
Yes. Browsers cache 301 redirects aggressively. If a user enters the old URL, the browser redirects immediately without contacting the server again.
Q: Does a 301 redirect pass SEO Link Equity?
Yes. Search engines pass 90-99% of page rank equity from the old URL to the new URL via 301 redirects.
Q: Does 301 change the request method?
Yes. Historically, browsers changed POST requests to GET during 301 redirections. Use 308 Permanent Redirect if the method must remain unchanged.
Q: How long does Google take to process a 301 redirect?
Usually between a few days to a few weeks, depending on how frequently the redirected URL is crawled.