HTTP status code for temporarily unavailable pages
Asked Answered
P

1

97

I'm redesigning my small business' website. I will be putting up a temporarily 'under construction' splash page. I know, I know... but it will be one in style, I hope. :)

What, mostly for SEO purposes, is the best HTTP status code to dish out for the URLs that will be temporarily unavailable (the same URLs will have content again, after the new site is up).

Now, my website traffic is hardly of any importance, but as a webdeveloper I want this knowledge in my toolbox for possible future client projects. And what better way to test and experiment with this, now that I have a convenient 'reason' with my own website.

Here's a few I thought about:
503 looks appealing, but is in the category of server errors.
204 looks appealing as well, but I'd rather temporarily redirect to the splash page.
307 looks like the best choice, but I'm not entirely sure.

There are a few others as well. So I'm curious to hear your advice. Thanks

Plenish answered 10/1, 2011 at 1:8 Comment(1)
Competitive answers deleted? Not very stackoverflowish.Izawa
B
142

I disagree to the selected answer. I would use the 503 code.

According to the RFC for HTTP/1.1:

503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay.

Yes, it should be an error, because the expected page will not appear.

Bordereau answered 16/4, 2013 at 13:13 Comment(5)
Note this is not claimed just by wikipedia. This interpretation actually comes from the RFC - tools.ietf.org/html/rfc2616#section-10.5.4Desexualize
Yes, you are right. And I've just checked: Wikipedia points that link as the source for many statements.Bordereau
Google suggests 503 too - googlewebmastercentral.blogspot.com/2011/01/… "We encounter a lot of problems with sites that return 200 (OK) result codes for server errors, downtime, bandwidth-overruns or for temporary placeholder pages (“Under Construction”). The 503 HTTP result code is the webmaster’s solution of choice for all these situations."Keirakeiser
I was given different templates for for both 503 and temporary maintenance , and I need to name them by the code, so I use 307. The semantics are 307 is planned; 503 is unplanned. But I'm open to your feedback.Maloriemalory
There's an important reason to choose (or not choose) 503 over other codes: by many client libraries, queue or webhook systems,... 5xx is is a temporary error (temporary service failure, temporary database failure, most exceptions result in 5xx, load balancer rebalance results in 5xx), and they may retry it after some time so the user even doesn't notice the problem (exponential backoff). Http errors other than 5xx (eg 4xx like bad credentials or validation errors) are generally treated as non-retryable (manual intervention needed to fix the issue)Bernie

© 2022 - 2024 — McMap. All rights reserved.