How exactly should I set a custom 503 "Page is down for maintenance" for my local website?

Hi :)

I've looked at a few different .htaccess file configurations and was reluctant to try them out before getting an opinion from someone who's done it before.

I'm working on somebody else's website, and I'd like the 503 page to display for a couple hours instead of having the old version of the website show.

These are the 2 different configs:

Number 1 :

ErrorDocument 503 /index.html

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [R=503,L]

Number 2 :

ErrorDocument 503 /path/to/503.html

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111$
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$
RewriteRule .* - [R=503,L]

I've had some bad experiences before with .htaccess files messing up my webpages, so if you could just point me in the right direction that would be great.

My primary concerns are that both the above solutions are no less than 6-8 years old, and that I'm really not sure which of the two I should use because they look pretty different.

Thanks for reading.

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown 路 Publish articles on custom domain 路 Gain readership on day zero 路 Automatic GitHub backup and more

Comments (1)

Pete's photo

I've had success using format Number 2