User Tools

Site Tools


503.sh

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
503.sh [2007/10/16 20:17]
196.217.233.196
503.sh [2007/10/16 21:08] (current)
andi old revision restored
Line 1: Line 1:
 +====== Return 503 Status with Apache ======
  
 +Sometime you want to do some heavy work on a virtual host and don't want anyone access your page. But you can't shut down your whole server and don't want to use any redirects to avoid confusing search engine spiders. Well the correct HTTP status code to return is a 503 - Service temporary unavailable.
 +
 +To do this create the following shellscript named ''​503.sh'':​
 +
 +<code bash>
 +#!/bin/sh
 +
 +echo "​Status:​ 503"
 +echo "​Content-Type:​ text/html; charset=iso-8859-1"​
 +echo ""​
 +
 +cat <<EOF
 +<​!DOCTYPE html PUBLIC "​-//​W3C//​DTD HTML 3.2//​EN">​
 +<​html>​
 +<​head>​
 +<​title>​503 - Service temporary unavailable</​title>​
 +</​head>​
 +<​body>​
 +<​h1>​503 - Service temporary unavailable</​h1>​
 +<​p>​Sorry,​ this website is currently down for maintainance please
 +retry in a few minutes</​p>​
 +</​body>​
 +</​html>​
 +EOF
 +</​code>​
 +
 +Then add this to your virtual host config and reload Apache:
 +
 +<code apache>
 +  ScriptAlias /  /​path/​to/​your/​503.sh/​
 +</​code>​
 +
 +Please note the trailing slash! It's needed!
503.sh.txt ยท Last modified: 2007/10/16 21:08 by andi