Skip to content

308 Permanent Redirect

The resource has moved permanently to a new URL, and clients must keep the same method and body when following the redirect.

What 308 Permanent Redirect means

308 is the permanent version of 307 and the method-safe version of 301. Clients follow the Location header and update links and caches, and a POST stays a POST.

It was first defined in RFC 7538 and is now part of RFC 9110. Google treats 308 the same as 301 for indexing. Very old clients may not understand it, which is one reason many sites still use 301 for plain page moves.

Headers that go with it

  • Location

Example response

HTTP/1.1 308 Permanent Redirect
Location: https://example.com/new-page
Content-Type: text/plain; charset=utf-8

308 Permanent Redirect

How to check for a 308 response

cURL

# Print only the status code (no -L, so the redirect isn't followed)
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/

JavaScript (Node.js)

const res = await fetch("https://example.com/", { redirect: "manual" });
if (res.status === 308) {
  console.log(res.status, res.statusText, res.headers.get("location"));
}

Python

import requests

res = requests.get("https://example.com/", allow_redirects=False)
if res.status_code == 308:
    print(res.status_code, res.reason, res.headers.get("Location"))

Go

client := &http.Client{
	CheckRedirect: func(*http.Request, []*http.Request) error {
		return http.ErrUseLastResponse
	},
}
res, err := client.Get("https://example.com/")
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 308 {
	fmt.Println(res.Status, res.Header.Get("Location"))
}

Specification

308 Permanent Redirect is defined in RFC 9110, section 15.4.9.

  • 301

    Moved Permanently

    The page has moved to a new URL for good. Browsers and search engines follow the Location header and update their links.

  • 307

    Temporary Redirect

    The resource is temporarily at another URL, and the client must repeat the exact same request there, keeping the method and body.

  • 302

    Found

    The resource is temporarily at a different URL. Clients follow the Location header but keep using the original URL in future.

← all 63 HTTP status codes

Type to search posts, tools and projects.

Keyboard shortcuts

Search+Kor/
Go to homegthenh
Go to bloggthenb
Go to projectsgthenp
Go to timelinegthent
Show this help?
Close search or helpesc