Sometimes you want to take a site offline for a while. You can put this in .htaccess or the vhost config:
ErrorDocument 503 "We are performing maintenance on the site. Check back in a few minutes." RewriteCond %{REMOTE_ADDR} !=1.2.3.4 RewriteEngine On RewriteRule .* - [R=503,L]
When using .htaccess, be sure to have AllowOverride All.
Or when using HTML files and images:
<VirtualHost *> ServerAdmin webmaster@ytec.nl ServerName www.example.nl DocumentRoot /var/www/down/ ErrorDocument 503 /maintenance.html RewriteCond %{REQUEST_URI} =/maintenance.html [OR] RewriteCond %{REQUEST_URI} =/logo.jpg RewriteRule (.*) $1 [L] RewriteEngine On RewriteRule .* - [R=503,L] </VirtualHost>
Recent Comments