HTTP 301 redirect is a permanent redirect status that notifies the client that the requested resource has been permanently moved to a new URL.
Regarding how long the browser caches HTTP 301, there is no fixed standard; this duration may vary by browser.
In practice, browsers typically determine the caching duration based on the Cache-Control or Expires headers sent by the server. If the server explicitly specifies a caching policy in the response, the browser will adhere to this policy. For example, if the response includes Cache-Control: max-age=3600, it indicates that the redirect should be cached for 3600 seconds (1 hour).
If the response headers do not explicitly indicate the caching duration, the browser may employ its default caching policy to determine the cache length. These default times can range from minutes to months, depending on the browser's implementation.
For a concrete example, suppose a website administrator modifies the site structure, permanently redirecting a commonly used page from http://example.com/old-page to http://example.com/new-page. The administrator sets up the HTTP 301 redirect on the server and specifies max-age=86400 in the Cache-Control header (equivalent to one day). In this case, when a user first attempts to access the old page, the browser receives the 301 redirect response and cache control header, and for the next day, any request to the old page will directly redirect to the new page without re-querying the server.
In summary, the caching duration for HTTP 301 redirects depends on the server configuration and the specific implementation of the browser. To manage the caching policy for redirects, server administrators should explicitly specify the cache control headers in the HTTP response.