Utilo

HTTP 301 Moved Permanently – Free, Online, Private

301 Moved Permanently means the resource has a new URL and clients should remember it.

What HTTP 301 means

301 says the target has moved and future requests should use the URI in Location. It is cacheable. Historically, clients rewrite a POST to GET when they follow a 301. If you need the method preserved, use 308. Use 301 for a hostname or path change that is permanent, not for a temporary maintenance page.

301 Moved Permanently belongs to the 3xx redirection class. Clients that only look at the class will group it with its neighbors. Clients that care about the exact code should use the narrower rule on this page, because the class is only the first digit.

When you see HTTP 301

When you see HTTP 301 Moved Permanently, stop on that exact status line. 301 Moved Permanently means the resource has a new URL and clients should remember it. The trace that usually produces it: A site moved from http to https or from a www host to an apex host. The 3xx redirection class only tells you the first digit. A neighbor in that class is a different fault, and the fix on this page does not transfer to it.

Return 301 when the URL has permanently changed and you want caches and browsers to store the new one. Send an absolute Location. Do not use 301 for a POST that must be replayed as POST. Do not chain 301s if you can point at the final URL.

How to fix HTTP 301

To fix HTTP 301, change the condition that made the server choose Moved Permanently. Update stored links to Location. If you were posting, assume a naive client will turn the follow-up into GET. Use 308 if that would lose the action. Do not retry the old URL. Request the Location. Replaying a POST against the old URL can loop or drop the body. If the log line is a different code, leave this page. The mix-up people make with 301 is this one: 302 and 307 are temporary. 308 is permanent and keeps the method. 301 is permanent and may change POST to GET.

  • A renamed article still has inbound links to the old path.
  • A client followed 301 and dropped the POST body, so the create never happened.
  • Several 301s in a row made a loop and the browser stopped.

An access log that only stores 301 is not enough to tell these apart. Keep the method, the path, and a request id. Do not keep the Authorization header or a request body that might be a token. The status explains the outcome. It is not a place to echo secrets back to the client either.

Example response

HTTP 301 Moved PermanentlyHTTP/1.1 301 Moved Permanently
Location: https://tools.tech4dream.com/en

Location is the new URL. A short HTML body is optional and is what very old clients show. Modern clients jump. Because the response is cacheable, a mistaken 301 is sticky. Clear it on purpose if you publish the wrong target.

What the client should do

Update stored links to Location. If you were posting, assume a naive client will turn the follow-up into GET. Use 308 if that would lose the action.

301 may be cached by default. Send Cache-Control if the redirect is not as permanent as the status claims. A cached 301 is hard for users to undo.

Do not retry the old URL. Request the Location. Replaying a POST against the old URL can loop or drop the body.

Codes people confuse with HTTP 301

302 and 307 are temporary. 308 is permanent and keeps the method. 301 is permanent and may change POST to GET.

Frequently asked questions

Will POST stay POST?

Do not rely on it. Many clients change a 301 follow-up to GET. Use 308 to keep the method.

Is 301 cached?

Yes, it may be stored. A wrong 301 lingers until the cache entry expires.

Can Location be relative?

Yes. Clients resolve it against the request URI. An absolute URL is easier to debug.

How is 302 different?

302 is temporary. Clients should keep using the original URL next time.

What should I do first when I see HTTP 301?

Read the status as 301 Moved Permanently specifically. 301 Moved Permanently means the resource has a new URL and clients should remember it. Then check the cause that matches the request you sent, starting with: A site moved from http to https or from a www host to an apex host.