Create a decent “sorry this site is down for maintenance” page with a “Have a Nice Day” message, then when you do need to upgrade things use the following htaccess rewrite rule to forward all traffic to this page.

Two solutions below. Both need you to have an HTML maintenance page ready. Both block every IP address other than yours – you need to be able to check everything’s working before you allow folks back, right? [Replace with your own!]

Maintenance option 1 – redirect everything to a particular directory

[Redirects all traffic to]

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^$
RewriteRule !maintenance/index.html /maintenance/index.html [L,NC,R=302]

Maintenance option 2 – redirects everything to a subdomain

[Redirects all traffic to a subdomain. From Ask Apache (I like)]

ErrorDocument 403
Order deny,allow
Deny from all
Allow from


Last updated on 9th March 2020