301 redirect

HTTP 301 Moved Permanently

A 301 redirect is a server reply that tells browsers and search engines a page has moved to a new URL permanently.

Checked 27/11/2026 against 3 sources. Next review 27/05/2027.

A 301 redirect is an HTTP status code meaning the requested page has permanently moved to the address in the Location header [2]. A browser that receives it automatically opens the new address [2]. Search engines attribute the links of the old URL to the new one, passing ranking to it [2]. Google treats a permanent redirect as a signal that the target should be the canonical page [1]. You use it when you change a URL, move to a new domain, or merge two pages. See also DNS if you are moving a domain.

When should I use a 301 instead of a 302?

It depends on how long the redirect will stay and which page you want Google to show [1]. A permanent redirect shows the new target in search results. A temporary redirect shows the source page [1]. Google advises permanent redirects when you are sure the redirect will not be reverted [1].

SituationRedirect type
Page moved to a new URL for goodPermanent: 301 or 308 [1]
Old domain replaced by a new onePermanent: 301 or 308 [1]
Short sale page, old page returns laterTemporary: 302 or 307 [1]

How do I set up a 301 redirect on Firebase Hosting?

In firebase.json, add a redirects list under hosting. Each rule has a source, a destination and a type. Use type 301 for Moved Permanently and 302 for a temporary redirect [3]. Hosting applies the first rule whose pattern matches the path, so order matters [3]. Redirects are checked before rewrites and before files on disk [3].

{
  "hosting": {
    "redirects": [
      {
        "source": "/old-services",
        "destination": "/services",
        "type": 301
      }
    ]
  }
}

On a server you control, such as Apache, Google says server-side redirects are set in the server configuration files, for example the .htaccess file [1].

How do I check that my 301 redirect works?

  1. Request the old URL In a terminal run curl -I on the old address. The reply should show 301 and a Location line with the new URL [2].
  2. Follow it to the end The new URL should reply 200, a normal page. Avoid sending the old URL through several hops before it lands.
  3. Update your own links Change menus, your XML sitemap and any canonical tag to the new address so they no longer rely on the redirect.
  4. Keep the redirect in place Leave it in place. Old links and bookmarks keep arriving after a move, and removing the rule sends those visitors to an error page.

What should I redirect when I redesign my website?

Any old URL that has links or traffic should point to the closest matching new page, not to the home page. If you are rebuilding a site and the addresses change, write a list of old-to-new pairs before launch and turn each into a rule. This protects the links other sites already point at you [2]. A full plan is in our website redesign guide.

A worked example

Say you rename /our-services to /services and /contact-us to /contact. You add two 301 rules, one per page. Anyone using an old bookmark lands on the new page, and Google moves its listing to the new address [1].

Questions people ask

Does a 301 redirect pass SEO value?

MDN says search engines attribute links to the original URL to the redirected resource, passing the SEO ranking to the new URL [2]. Google uses a permanent redirect as a signal that the target should be canonical [1].

What is the difference between 301 and 308?

Both mean permanent, and Google lists both as permanent redirects [1]. MDN says a browser may change a POST request to GET after a 301, while a 308 response prohibits changing the method [2].

Can I use JavaScript to redirect instead?

Google says to use JavaScript redirects only if you cannot do a server-side or meta refresh redirect [1]. A server-side redirect has the highest chance of being read correctly [1].

See also

  • Canonical tag A canonical tag is a line of HTML that tells search engines which URL is the main version when several URLs show the same page.
  • XML sitemap An XML sitemap is a file on your website that lists the pages you want search engines to find, usually at /sitemap.xml.
  • robots.txt A robots.txt file is a plain text file at the root of your site that tells search crawlers which URLs they may visit.
  • Web hosting Web hosting is renting space on a web server that stays connected to the internet, so your website's files can be sent to anyone who asks.
  • Domain name A domain name is your website's address on the internet, such as example.com.sg, that people type to reach your site and send email to you.
  • Indexing Indexing is when Google analyses a page it has crawled and stores the result in its index, so the page can be shown for matching searches.

References

  1. Redirects and Google Search, Google Search Central. Read 27/11/2026.Use permanent redirects when you're sure that the redirect won't be reverted.
  2. 301 Moved Permanently, MDN Web Docs. Read 27/11/2026.Search engines receiving this response will attribute links to the original URL to the redirected resource, passing the SEO ranking to the new URL
  3. Hosting configuration: redirects, Firebase Documentation. Read 27/11/2026.Hosting applies the redirect defined by the first rule with a URL pattern that matches the requested path