HTTP 301 Moved Permanently — What It Means & How to Debug
HTTP 301 Moved Permanently is a redirect response indicating the requested resource has been permanently moved to a new URL — browsers and search engines update their records.
What It Means
The HTTP 301 Moved Permanently status code is a redirect response that tells the client the requested resource now lives at a different URL permanently. When a browser or search engine crawler receives a 301, it updates its bookmarks or index with the new URL and makes all future requests directly to the new location.
The response must include a Location header with the new canonical URL. Most HTTP clients automatically follow 301 redirects without user intervention, though the behavior differs slightly between GET and POST requests.
When It’s Sent
- Website migration — moving from
http://tohttps:// - Domain change — a site moves from
oldsite.comtonewsite.com - URL restructuring — changing the URL slug of a blog post or product page
- Removing trailing slashes or enforcing a
www/ non-wwwcanonical domain - Redirecting old API versions —
/v1/usersredirects to/v2/users
Real Example
curl -v http://example.com/old-pageExpected response:
> GET /old-page HTTP/1.1
> Host: example.com
>
< HTTP/1.1 301 Moved Permanently
< Location: https://example.com/new-page
< Content-Length: 0
<The Location header tells the client where to find the resource. Modern browsers automatically follow the redirect and display the new URL in the address bar.
How to Debug
Browser DevTools
- Open the Network tab and check Preserve log (redirects clear the log by default)
- Load the old URL
- Look for a request with status
301 Moved Permanently - Check the Headers tab for the
Locationfield - A second request appears automatically — this is the browser following the redirect
curl
curl -I https://example.com/old-pageThe -I (head) flag shows only headers. Look for the Location line. To prevent curl from following the redirect, add -L to follow it or omit it:
curl -s -o /dev/null -w "Status: %{http_code}\nRedirect: %{redirect_url}" \
https://example.com/old-pagePostman
Disable Automatically follow redirects in Settings to see the 301 response. Enable it to see the final destination. Check the Location header under Headers.
How to Fix
If you encounter an unexpected 301 redirect:
- Server-side (Nginx): Check for
return 301orrewritedirectives in the server block - Server-side (Apache): Look in
.htaccessforRedirect 301orRewriteRuledirectives - Server-side (Express/Node.js): Search for
res.redirect(301, ...)calls in route handlers - Caching: Browsers cache
301redirects aggressively — clear the browser cache or usecurlto bypass it - Canonical tags: Check if a CMS or SEO plugin is emitting a
301via a redirect rule
Common Causes
| Scenario | What Happens | Why It Matters |
|---|---|---|
| HTTP to HTTPS redirect | http:// requests get 301 to https:// | Ensures secure connections |
| Page slug change | old-slug redirects to new-slug | Preserves SEO equity |
| Domain migration | oldsite.com redirects to newsite.com | Transfers all traffic to new domain |
| Trailing slash enforcement | /page redirects to /page/ | Standardizes URL structure |
| API version deprecation | /v1/users redirects to /v2/users | Guides clients to new API version |
FAQ
Related Codes
- HTTP 302 Found — temporary redirect, preserves original URL
- HTTP 307 Temporary Redirect — temporary redirect, preserves HTTP method
- HTTP 308 Permanent Redirect — permanent redirect, preserves HTTP method
- HTTP 404 Not Found — what happens when there’s no redirect and the page doesn’t exist
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro