What Is a 301 Redirect?
Understand how 301 redirects work, when to use permanent redirects, how they affect SEO and how to avoid common redirect problems.
A 301 redirect is an HTTP redirect that tells browsers and search engines that a web page has permanently moved to a different URL. When a client requests the old address, the server responds with HTTP status code 301 and provides the new location.
301 redirects are commonly used when changing URL structures, moving pages, migrating websites, switching domains or consolidating duplicate content. When configured correctly, they help visitors reach the correct destination while allowing search engines to understand that the old URL has been permanently replaced.
What Does 301 Mean?
The number 301 is an HTTP status code defined for permanent redirection. It indicates that the requested resource has been assigned a new permanent URL and that clients should use the new address for future requests.
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-pageThe Location header tells the browser or crawler where the resource has moved. A browser will normally follow the redirect automatically and display the destination page.
How a 301 Redirect Works
A 301 redirect happens before the original page is normally delivered. The client requests the old URL, the server returns a 301 response with a Location header, and the client follows the new URL.
| Step | Action |
|---|---|
| 1 | User or crawler requests the old URL |
| 2 | Server returns HTTP 301 |
| 3 | Response includes the new URL in Location |
| 4 | Client requests the destination URL |
| 5 | Destination page is returned |
Simple Example
Suppose an article originally exists at /old-article and has been replaced by /new-article. Instead of leaving the old page unavailable, the server can permanently redirect visitors and search engines to the new URL.
https://example.com/old-article
↓
301 Redirect
↓
https://example.com/new-article301 Redirects and SEO
301 redirects are important for SEO because they help search engines understand that an old URL has been permanently replaced. A properly implemented redirect can consolidate signals associated with the old URL and guide crawlers toward the preferred destination.
A redirect does not automatically make a new page rank well. The destination still needs to provide useful content, be accessible to search engines and satisfy the intent of the original page when appropriate.
When Should You Use a 301 Redirect?
A 301 redirect is appropriate when the old URL should permanently point to another location. The most common cases involve URL changes, website migrations and content consolidation.
- A page has moved to a new URL.
- A website changes its domain name.
- HTTP URLs are permanently redirected to HTTPS.
- URL structures are redesigned.
- Several duplicate pages are consolidated.
- An outdated page is replaced by a newer equivalent.
- A website migration changes many existing URLs.
Changing a Page URL
Changing a URL without redirecting the old address can leave visitors and search engines with a broken link. A 301 redirect connects the old address to the new one and helps preserve continuity after the URL changes.
Old:
https://example.com/blog/web-development
New:
https://example.com/articles/web-development
Redirect:
301 /blog/web-development → /articles/web-developmentDomain Migration
When a website moves from one domain to another, 301 redirects can be configured from the old domain to the corresponding URLs on the new domain. Mapping equivalent pages individually is generally better than sending every old URL to a single homepage.
| Old URL | New URL |
|---|---|
| old-example.com/ | new-example.com/ |
| old-example.com/about | new-example.com/about |
| old-example.com/products/tool | new-example.com/products/tool |
HTTP to HTTPS Redirects
Websites that permanently move from HTTP to HTTPS commonly redirect their HTTP URLs to the equivalent HTTPS URLs. This ensures visitors using older links are automatically sent to the secure version of the site.
http://example.com/page
↓
https://example.com/pagewww and Non-www Redirects
A website may be configured to use either www or non-www URLs as its preferred hostname. If both versions are accessible, a permanent redirect can establish one canonical host and prevent unnecessary duplication.
| Preferred Version | Redirect |
|---|---|
| www.example.com | example.com → www.example.com |
| example.com | www.example.com → example.com |
301 Redirects in Apache
Apache servers can configure redirects through server configuration or .htaccess files. A simple permanent redirect can map one old path directly to a new destination.
Redirect 301 /old-page https://example.com/new-pageApache rewrite rules can also be used when redirects require pattern matching, conditions or more advanced URL transformations.
RewriteEngine On
RewriteRule ^old-page$ /new-page [R=301,L]301 Redirects in Nginx
Nginx can issue permanent redirects directly from its server configuration. The return directive is useful for straightforward URL changes.
location = /old-page {
return 301 https://example.com/new-page;
}Redirecting Multiple URLs
Large websites may need to redirect hundreds or thousands of URLs during a migration. Instead of creating every rule manually, patterns can sometimes be used when the old and new URL structures follow a predictable relationship.
location /old-section/ {
return 301 https://example.com/new-section$request_uri;
}301 Redirect vs 302 Redirect
The main difference between 301 and 302 redirects is whether the move is intended to be permanent. A 301 communicates a permanent change, while a 302 is generally used for a temporary redirect.
| Feature | 301 | 302 |
|---|---|---|
| Meaning | Permanent move | Temporary move |
| Typical use | Permanent URL change | Temporary campaign or maintenance |
| SEO signal | Permanent replacement | Temporary destination |
| Expected duration | Long-term | Short-term |
Avoid Using 301 for Temporary Redirects
If a page is only temporarily unavailable or temporarily points to another location, a 301 may communicate the wrong intent. Choosing the appropriate redirect status helps browsers, crawlers and other clients understand how the URL should be treated.
Redirect Chains
A redirect chain occurs when one URL redirects to another URL that redirects again before reaching the final destination. For example, an old URL might redirect to an intermediate URL that eventually redirects to the current page.
/old-page
↓ 301
/intermediate-page
↓ 301
/new-pageRedirect chains add unnecessary requests and make website crawling and troubleshooting more complicated. Whenever possible, the original URL should redirect directly to the final destination.
Redirect Loops
A redirect loop happens when redirects point back to one another and the client can never reach a final page. For example, URL A may redirect to URL B while URL B redirects back to URL A.
/page-a
↓ 301
/page-b
↓ 301
/page-aBrowsers typically report a redirect loop as an error because they cannot complete the request. Redirect loops are often caused by conflicting server rules, incorrect HTTPS configuration or overlapping application redirects.
Common 301 Redirect Mistakes
- Redirecting every old URL to the homepage.
- Creating unnecessary redirect chains.
- Creating redirect loops.
- Using 301 for temporary redirects.
- Redirecting to unrelated content.
- Forgetting to update internal links after a migration.
- Leaving obsolete redirects without reviewing them.
- Using overly broad rewrite patterns.
301 Redirects and Internal Links
Redirects can help preserve access to old URLs, but internal links should still point directly to the current destination whenever possible. Updating navigation, content links and other internal references reduces unnecessary redirects and makes the site easier to crawl.
301 Redirects and Sitemaps
XML sitemaps should normally contain the preferred final URLs rather than URLs that redirect elsewhere. After a URL migration, updating the sitemap helps search engines discover the current addresses directly.
Testing a 301 Redirect
A redirect should be tested before and after deployment. Verify the HTTP status, Location header and final destination, and make sure the destination does not introduce another unnecessary redirect.
curl -I https://example.com/old-pageA successful permanent redirect should return a 301 status and normally include a Location header pointing to the destination URL.
301 Redirects During Website Migration
Website migrations often involve changes to URLs, domains, technologies or site structure. Creating a redirect map before the migration makes it easier to identify which old URLs should point to which new destinations.
| Migration Task | Purpose |
|---|---|
| Export old URLs | Identify existing pages |
| Map new URLs | Define destination pages |
| Create redirects | Connect old and new addresses |
| Update internal links | Avoid unnecessary redirects |
| Update sitemap | Submit current URLs |
| Test redirects | Detect errors and loops |
How Long Should a 301 Redirect Stay?
A permanent redirect should generally remain in place as long as users or external websites may still request the old URL. Removing a redirect too early can turn old bookmarks, backlinks and search results into broken links.
Best Practices
- Use 301 only when the URL change is permanent.
- Redirect old URLs to the most relevant new destinations.
- Avoid redirect chains and loops.
- Update internal links to point directly to final URLs.
- Keep XML sitemaps focused on canonical destination URLs.
- Test redirects after every major URL migration.
- Use precise rewrite rules instead of overly broad patterns.
- Keep important redirects active for as long as they are needed.
Frequently Asked Questions
What is a 301 redirect?
A 301 redirect is an HTTP permanent redirect that tells browsers and search engines that a resource has moved to a different URL.
Does a 301 redirect affect SEO?
Yes. A correctly configured 301 redirect helps search engines understand that an old URL has been permanently replaced and can consolidate relevant signals toward the destination.
What is the difference between 301 and 302?
A 301 indicates a permanent move, while a 302 is generally used when the redirect is temporary.
Should I redirect an old page to the homepage?
Usually not. The old URL should preferably redirect to the most relevant equivalent page. Sending unrelated pages to the homepage can create a poor user experience.
Can a 301 redirect cause a redirect loop?
Yes. Incorrect redirect rules can make URLs redirect back to one another, preventing the browser from reaching a final destination.
Should redirected URLs be included in the sitemap?
Normally no. The sitemap should contain the preferred final URLs rather than URLs that simply redirect to another address.
Helpful SEO and Server Tools
A Redirect Chain Analyzer helps identify chains and loops between URLs, a Canonical URL Generator creates canonical link values, an .htaccess Generator helps build Apache configuration rules, an Apache Rewrite Generator assists with rewrite and redirect rules, and an Nginx Config Generator helps create Nginx server configuration for common redirect scenarios.
Conclusion
A 301 redirect is the standard way to communicate that a URL has permanently moved to a new location. It is useful for URL changes, domain migrations, HTTPS upgrades, content consolidation and website restructuring. Properly configured redirects help visitors reach the correct content, allow search engines to understand URL changes and reduce the risk of broken links. By avoiding redirect chains, loops and irrelevant destinations—and by keeping internal links and sitemaps updated—developers can make permanent URL migrations safer and easier to maintain.