HTTP 301 Moved Permanently — What It Means and How to Fix It

The HTTP 301 (Moved Permanently) status code indicates that the requested resource has been assigned a new permanent URI and any future references to this resource should use one of the returned URIs. Clients should automatically redirect to the new URL provided in the 'Location' header and update any bookmarks or links accordingly. This status code signifies a permanent change in the resource's location.

Last updated: 2026-06-11

RECOMMENDED

Essential Reading: Designing Data-Intensive Applications

The system design bible for software engineers. Learn to build reliable, scalable, and maintainable systems.

View on Amazon →
Status Code 301
Name Moved Permanently

Common Causes

  • Website migration to a new domain or subdomain
  • Changing the URL structure of a website (e.g., from non-SEO friendly URLs to SEO friendly ones)
  • Consolidating duplicate content from different URLs to a single canonical URL
  • Enforcing HTTPS by redirecting all HTTP requests to their HTTPS equivalents
  • Correcting typos or outdated URLs

Code Examples to Handle HTTP 301

curl -I https://httpbin.org/status/301

How to Fix It

  1. Verify the 'Location' header in the 301 response to ensure it points to the correct new URL. Use browser developer tools or a `curl -I` command.
  2. Check server configuration files (e.g., Apache's `.htaccess`, Nginx's configuration, or web server settings) for `Redirect permanent` or `rewrite` rules that might be incorrectly configured.
  3. If using a Content Management System (CMS) like WordPress, check for redirect plugins or built-in redirect functionalities that might be misconfigured or pointing to the wrong destination.
  4. Examine DNS records if the domain itself has changed, ensuring they point to the correct server for the new domain.
  5. Update any internal links on your website and external backlinks that might still be pointing to the old URL to prevent unnecessary redirects and improve SEO.
💡 Example: A company decides to change its website's domain from `oldcompany.com` to `newcompany.com`. When a user tries to access `oldcompany.com/products`, the server responds with a 301 Moved Permanently status code, including a 'Location' header pointing to `newcompany.com/products`. The user's browser then automatically navigates to the new URL.
🛠️ Developer Tip: Always use 301 redirects for permanent URL changes to preserve SEO value and ensure search engines update their indexes correctly. Avoid using 302 (Found) for permanent moves, as it signals a temporary change and can negatively impact search engine rankings.

Related Status Codes

Frequently Asked Questions

What causes HTTP 301?

HTTP 301 is caused by server-side configurations that explicitly tell a client that a resource has permanently moved to a new URL. This is typically done through server rewrite rules, CMS redirect settings, or direct code implementations.

How do I fix HTTP 301?

To fix an unintended or incorrect 301 redirect, you need to identify where the redirect is configured (e.g., server configuration files like `.htaccess`, Nginx config, CMS redirect plugins, or application code) and update or remove the redirect rule to point to the correct location or remove the redirect entirely.