16

While performing some upcoming maintenance, I'm going to have to redirect all site traffic to a maintenance page briefly. What's the proper status code to use for the redirect?

503 makes sense, but it's not technically a redirection status. 302 is a temp redirect, but wondering if that might have implications if the site is being spidered at the time.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Thody
  • 1,960
  • 3
  • 23
  • 31
  • 1
    That's an interesting question. It seems that Google does not have an official statement on this: http://www.google.com/search?q=site%3Agoogle.com+http+redirects+-301 – jkndrkn Nov 09 '09 at 15:10
  • 1
    Google has since posted their take on this. It more or less matches johannes's answer. http://googlewebmastercentral.blogspot.com/2011/01/how-to-deal-with-planned-site-downtime.html – Joe D'Andrea Dec 27 '11 at 16:24

3 Answers3

22

I would use 503, too, combined with a Retry-After header. A proper robot should know how to handle this.

johannes
  • 15,807
  • 3
  • 44
  • 57
1

302 Found would probably be the classic way - not a permanent redirect. You want it to be temporary though, so when the spider came back, it would try it again, but which time, it should be back up. A 301 would indicate to not go to the original.

The 500 series are errors, not what you want to indicate.

Alister Bulman
  • 34,482
  • 9
  • 71
  • 110
  • 4
    True, but 503 does explicitly refer to being down for maintenance, which is obviously a less severe error than a 500 for example. – Thody Nov 09 '09 at 15:14
1

Use 503, and if you want to redirect, do it via JavaScript on the served page.

Just be careful not to lose the original URL (save it as a query parameter, for example), as users are expecting to return to the page they were looking for when the maintenance is done.

user
  • 23,260
  • 9
  • 113
  • 101