php - What is the correct HTTP status code to send when a site is down for maintenance? - Stack Overflow
112 captures
12 May 2010 - 29 Dec 2025
Sep
OCT
Nov
11
2015
2016
2017
success
fail
About this capture
COLLECTED BY
Organization:
Internet Archive
These crawls are part of an effort to archive pages as they are created and archive the pages that they refer to. That way, as the pages that are referenced are changed or taken from the web, a link to the version that was live when the page was written will be preserved.
Then the Internet Archive hopes that references to these archived pages will be put in place of a link that would be otherwise be broken, or a companion link to allow people to see what was originally intended by a page's authors.
The goal is to
fix all broken links on the web
Crawls of supported "No More 404" sites.
Collection:
Wikipedia Near Real Time (from IRC)
This is a collection of web page captures from links added to, or changed on, Wikipedia pages. The idea is to bring a reliability to Wikipedia outlinks so that if the pages referenced by Wikipedia articles are changed, or go away, a reader can permanently find what was originally referred to.
This is part of the Internet Archive's attempt to
rid the web of broken links
TIMESTAMPS
The Wayback Machine - https://web.archive.org/web/20161011013125/https://stackoverflow.com/questions/2786595/what-is-the-correct-http-status-code-to-send-when-a-site-is-down-for-maintenance
current community
chat
Stack Overflow
Meta Stack Overflow
your communities
or
to customize your list.
more stack exchange communities
company blog
Stack Exchange
Inbox
Reputation and Badges
tour
help
Tour
Start here for a quick overview of the site
Detailed answers to any questions you might have
Meta
Discuss the workings and policies of this site
Learn more about Stack Overflow the company
Business
Learn more about hiring developers or posting ads with us
Stack Overflow
Questions
Jobs
Documentation
Tags
Users
Badges
Ask Question
Dismiss
Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
What is the correct HTTP status code to send when a site is down for maintenance?
up vote
47
down vote
favorite
10
Is there a HTTP status code to tell Google (and others) to
go away, index me again later
Basically, one that semantically tells clients that the site is down for maintenance?
The ones I have considered are
304 => Not modified
307 => Temporary redirect
410 => Gone
503 => Service Unavailable
I'm leaning towards the last one, but was just curious as to which one was
proper
choice.
php
http
http-response-codes
share
improve this question
edited
Sep 23 '11 at 22:46
asked
May 7 '10 at 6:21
alex
266k
128
651
804
add a comment
4 Answers
active
oldest
votes
up vote
62
down vote
accepted
HTTP 503
would be the most appropriate:
The Web server (running the Web site) is currently unable to handle the HTTP 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.
This post on the Google Webmaster Central Forum is also relevant:
Can I restrict Google from crawling my site on a specific day of the week?
Yes - a 503 is the correct server response for "We're closed". If you substitute a normal HTML page saying "We're closed" and serve a 200 it's very likely to get indexed by Google.
If you give the Googlebot a 503, it will just go away and come back later without indexing what you give it.
UPDATE:
As for the php implementation, you may be interested in checking out the following article:
The holding page and the 503 status code
Also notice the
retry-after
header, where you can specify after how many seconds another request should be re-attempted.
share
improve this answer
edited
May 7 '10 at 6:32
answered
May 7 '10 at 6:22
Daniel Vassallo
208k
43
386
380
add a comment
up vote
down vote
From
503 (Service unavailable) The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
share
improve this answer
answered
May 7 '10 at 6:23
Lee
85
add a comment
up vote
down vote
I'd consider the 503 to be most appropriate, since the 5xx-group is meant for server errors in general.
share
improve this answer
answered
May 7 '10 at 6:23
Ham
2,305
23
add a comment
up vote
down vote
503 Service Unavailable
share
improve this answer
answered
May 7 '10 at 6:23
dan04
47.1k
12
110
145
add a comment
Not the answer you're looking for? Browse other questions tagged
php
http
http-response-codes
or
ask your own question
asked
6 years ago
viewed
12396 times
active
5 years ago
Related
663
HTTP status code for update and delete?
65
What is correct HTTP status code when redirecting to a login page?
101
PHP: How to send HTTP response code?
What is the best practice approach and status code for temporary maintenance pages?
RSpec testing in Rails and 304 HTTP status code
HTTP status codes: differentiating between being over capacity and being down for maintenance
What HTTP response code should be returned when a constraint fails?
What is the correct HTTP code to indicate “not logged in”?
What HTTP response code is appropriate for stale object?
HTTP status code for “never going to exist”
Hot Network Questions
Can a new platform / cryptocurrency be built on top of Monero?
Stopping time, by speeding it up inside a bubble
Why was Kepler's orbit chosen to continue to drift away from Earth?
Converting SCART to VGA/Jack
Is it possible to inverse selection in Object mode?
When must I use #!/bin/bash and when #!/bin/sh?
Does Zootopia have an intentional Breaking Bad reference?
Will something accelerate forever if a constant force is applied to it on a frictionless surface? If so how?
Can Communism become a stable economic strategy? How?
How to keep accurate millis() while using ADC_sleep mode?
Can I stack an Animated Shield with the Shield spell?
Does the string "...CATCAT..." appear in the DNA of Felis catus?
sometimes Replace doesn't work?
Should ideal specular multiply light colour with material colour?
What would be a good approach to make sure my advisor goes through all the report?
When stating a theorem in textbook, use the word "For all" or "Let"?
What is Monero Meta?
Making my building blocks modular (Solved)
Simulate keystrokes
How common is it to have a demo at a doctoral thesis defence session?
Mapping many-to-many relationship
I don't want to get lung cancer like you do
Is it rude or cocky to request different interviewers?
Unix command that immediately returns a particular return code?
more hot questions
question feed
lang-php
tour
help
blog
chat
data
legal
work here
advertising info
mobile
feedback
Technology
Life / Arts
Culture / Recreation
Science
Other
Stack Overflow
Server Fault
Super User
Web Applications
Ask Ubuntu
Webmasters
Game Development
TeX - LaTeX
Programmers
Unix & Linux
Ask Different (Apple)
WordPress Development
Geographic Information Systems
Electrical Engineering
Android Enthusiasts
Information Security
Database Administrators
Drupal Answers
SharePoint
User Experience
Mathematica
Salesforce
ExpressionEngine® Answers
Cryptography
Code Review
Magento
Signal Processing
Raspberry Pi
Programming Puzzles & Code Golf
more (7)
Photography
Science Fiction & Fantasy
Graphic Design
Movies & TV
Music: Practice & Theory
Seasoned Advice (cooking)
Home Improvement
Personal Finance & Money
Academia
more (8)
English Language & Usage
Skeptics
Mi Yodeya (Judaism)
Travel
Christianity
English Language Learners
Japanese Language
Arqade (gaming)
Bicycles
Role-playing Games
Anime & Manga
more (18)
Mathematics
Cross Validated (stats)
Theoretical Computer Science
Physics
MathOverflow
Chemistry
Biology
Computer Science
Philosophy
more (3)
Stack Apps
Meta Stack Exchange
Area 51
Stack Overflow Careers
site design / logo © 2016 Stack Exchange Inc; user contributions licensed under
cc by-sa 3.0
with
attribution required
rev 2016.10.10.4051