What Is a 301 Status Code?

What Is a 301 Code?
A 301 redirect signals a permanent move from one URL to another, meaning the page in question has moved locations.
A 301 redirect helps with internal linking and site upkeep without harming the user experience (UX). This piece of code directs users from an old page location to the new one seamlessly.
However, to use 301 status codes effectively on your own site — or recognize them while browsing — you must understand them.
This page will break down everything there is to know about 301 status codes and redirects, including the following topics:
- What is a 301 status code?
- How does a 301 redirect work?
- 301 code references
- 301 status code example
- How to fix a 301 redirect
- FAQ
Read on to learn more about 301 status codes!
What is a 301 status code?
A 301 redirect signals a permanent move from one URL to another, meaning the page in question has moved locations.
If you see a 301 status code on a page, the target resource has been assigned a new permanent URI, and any future references to this resource ought to use one of the enclosed URIs.
How does a 301 redirect work?
If you own a site and have link-editing capabilities, you can automatically re-link references to the new URI to one or more of the new references sent by the server, where possible.
From there, the server should generate a Location header field in the response containing a preferred URI reference for the new permanent URI. The user may then use the Location field value for automatic redirection. The server’s response payload usually contains a short hypertext note with a hyperlink to the new URI(s).
Note: For historical reasons, a user agent may change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 Temporary Redirect status code can be used instead.
A 301 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls.
301 code references
Rails HTTP Status Symbol :moved_permanently
Go HTTP Status Constant http.StatusMovedPermanently
Symfony HTTP Status Constant Response::HTTP_MOVED_PERMANENTLY
Python2 HTTP Status Constant httplib.MOVED_PERMANENTLY
Python3+ HTTP Status Constant http.client.MOVED_PERMANENTLY
Python3.5+ HTTP Status Constant http.HTTPStatus.MOVED_PERMANENTLY
.NET HttpStatusCode.MovedPermanently
Rust http::StatusCode::MOVED_PERMANENTLY
Java java.net.HttpURLConnection.HTTP_MOVED_PERM
Apache HttpComponents Core org.apache.hc.core5.http.HttpStatus.SC_MOVED_PERMANENTLY
Angular @angular/common/http/HttpStatusCode.MovedPermanently
301 status code example
Here’s an example of a request and response for a 301 status code:
Request
GET /old-page.html HTTP/1.1
Host: example.com
Response
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page.html
Content-Length: 0
In this example, the client sends a GET request for an old page located at “/old-page.html” on the host “example.com”. The server responds with a 301 status code, indicating that the requested resource has been permanently moved to a new location, and providing the new URL in the “Location” header.
The client should follow this new URL in order to retrieve the resource, and the server sends a “Content-Length” header with a value of 0 to indicate that there is no content in the response body.
How to fix a 301 redirect
To troubleshoot and fix a 301 redirect, you can follow these steps:
- Identify the redirect: Use a web browser and navigate to the old URL that is being redirected. Check the HTTP status code returned by the server using the developer tools or a tool like Screaming Frog SEO Spider. A 301 redirect will return a status code of 301.
- Check the redirect destination: Make sure that the destination URL is correct and functional by using our free redirect checker tool. Ensure that the new page or website is loading correctly and that there are no errors.
- Update links and references: Update any internal or external links, bookmarks, or references to the old URL with the new URL.
- Implement the redirect: If the redirect is not yet implemented, use server-side configuration or web application code to set up the redirect. This can be done using a .htaccess file or a server-side script. Make sure that the redirect is set up correctly and that it is returning the correct HTTP status code.
- Test the redirect: Use a web browser and navigate to the old URL again. Check the HTTP status code returned by the server and make sure that it is now returning a 301 redirect to the new URL.
- Monitor for issues: Monitor web analytics and search engine rankings to ensure that the redirect is working correctly and that there are no negative impacts on traffic or rankings.
By following these steps, you can troubleshoot and fix a 301 redirect to ensure that users can still find the content they are looking for and that search engine rankings are maintained.
FAQs about 301 redirects
Learn more about 301 redirects with these FAQs:
What causes a 301 redirect?
A 301 redirect is caused by a server or website administrator changing the URL of a web page or website, either by moving the content to a new URL or by updating the website’s structure or architecture. This can happen for a variety of reasons, such as rebranding, consolidating content, or improving the site’s search engine optimization (SEO).
By using a 301 redirect, the administrator informs both users and search engines that the content has been permanently moved to a new location, and any links or bookmarks to the old URL should be updated to the new URL. This helps to ensure that users can still find the content they are looking for and that search engines can update their indexes accordingly.
When should you use a 301 redirect?
A 301 redirect should be used when a web page or website is permanently moved to a new URL.
This is typically done to maintain the page’s search engine rankings and to ensure that users can still find the content they are looking for. A 301 redirect is the best way to inform search engines that the content has been permanently moved to a new location, and that any links or bookmarks to the old URL should be updated to the new URL.
Some common situations where a 301 redirect might be used include:
- Website rebranding
- Website restructuring
- Content consolidation
It is important to ensure that the redirect is implemented correctly to avoid any negative impact on search engine rankings and user experience.
When should you not use a 301 redirect?
A 301 redirect should not be used in certain situations, such as:
- Temporary redirects: If the move is temporary, a 302 or 307 redirect should be used instead of a 301 redirect.
- Redirect chains: Avoid setting up a series of multiple redirects, also known as redirect chains, as they can slow down page load times and cause issues with search engine rankings.
- Incorrect use of redirects: Avoid using redirects as a substitute for proper page content or design. A redirect should be used only to send users to the correct page.
- Domain changes: If there is a domain name change, it may be more appropriate to use a domain level redirect, such as a 301 redirect at the DNS level, instead of a URL level 301 redirect.
In summary, a 301 redirect should not be used in situations where it is not appropriate or where other types of redirects are more suitable. It is important to use the appropriate redirect type to ensure that users and search engines are directed to the correct page and that there are no negative impacts on website traffic or rankings.
What is the difference between a 301 and 302 status code?
A 301 status code is a permanent redirect to a new URL, while a 302 status code is a temporary redirect to a new URL. The client should update bookmarks and links for a 301 redirect, but continue to use the old URL for a 302 redirect. The difference between the two codes is in their intended meaning and behavior.
Additional resources from WebFX
Want to keep learning about the ins and outs of internet marketing, web development, and design? Read through the resources below to find more topics related to 301 status codes!
- Learn about web development
- Learn about SEO
- Web development services from WebFX
- SEO services from WebFX
- MDN Web Docs
- W3Schools
Marketing Tips for Niche Industries
- Travel and Tourism Marketing Budget
- Urgent Care Marketing Ideas: 5 High-ROI Tactics
- Vision Care Industry Statistics
- WebFX: Your Education Digital Marketing Agency
- Why Auto Part Retailers Need Digital Marketing
- Why Digital Marketing is Essential for Auctioneers
- Your Guide to Digital Marketing for Exercise Equipment Companies
- Your Guide to Digital Marketing for Industrial Repair Companies
- 2025 Professional Services Trends: Embracing the FutureÂ
- 6 Best Heavy Equipment Marketing Agencies