Logo
DevUtilsAll-in-one toolkit
Back to all codes
3013xx
3xx — Redirection

Moved Permanently

The URL of the requested resource has been changed permanently. The new URL is given in the response.

What it means

The HTTP 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the `Location` headers.

A browser redirects to this page and search engines update their links to the resource (in 'SEO-speak', it is said that the 'link juice' is sent to the new URL).

How it works

  • 1The client requests an old URL.
  • 2The server responds with '301 Moved Permanently' and provides the new URL in the 'Location' header.
  • 3The browser automatically makes a new GET request to the new URL.
  • 4The browser (and search engines) permanently cache this redirection.

Why you're seeing this

  • The site architecture changed, or a routing rule (like removing trailing slashes) is enforced.

How to fix it

  • If you accidentally set a 301 and it got cached in your browser, you will need to clear your browser cache to stop it from automatically redirecting.

Framework Implementations

Next.js (next.config.js)

module.exports = {
  async redirects() {
    return [{ source: '/old', destination: '/new', permanent: true }];
  }
};

Real-Life Scenarios

Use this when you restructure your website URLs, migrate to a new domain, or want to enforce HTTPS over HTTP.

Domain Migration

A company rebrands from old-name.com to new-name.com. All requests to old-name.com return a 301 redirect to the exact same path on new-name.com.

HTTP to HTTPS

Forcing all insecure traffic to upgrade to secure HTTPS.

HTTP Transaction

1. Client Request

GET /about-us.html HTTP/1.1
Host: mysite.com

2. Server Response

HTTP/1.1 301 Moved Permanently
Location: https://mysite.com/about
Content-Length: 0

SEO Implications

The most important status code for SEO. It passes ~90-99% of ranking power (link equity) to the redirected page. Always use 301 instead of 302 for permanent moves.

Related Codes