Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper status code for a maintenance page redirect?

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.

like image 716
Thody Avatar asked Nov 09 '09 15:11

Thody


3 Answers

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

like image 65
johannes Avatar answered Sep 20 '22 14:09

johannes


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.

like image 44
Alister Bulman Avatar answered Sep 19 '22 14:09

Alister Bulman


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.

like image 35
user Avatar answered Sep 18 '22 14:09

user