Adding a Temporary Maintenance Downtime Message
If you want your site to show a respective message during maintenance downtime then the following hint could be useful.
.Htaccess Code
Paste the block before any other rule in the .htaccess file in the root of your installation.
#############################################################
# uncomment the following block during maintenance downtime
###################### START MAINTENANCE#####################
#############################################################
RewriteCond %{REQUEST_URI} !^/*down.php
RewriteCond %{REMOTE_ADDR} !123.123.123.123 [NC] # paste your gw's ip here
RewriteRule ^/*(.*)$ ./down.php [L]
RewriteCond %{REQUEST_URI} ^/*down.php
RewriteRule ^/*down.php - [L]
############################################################
###################### END MAINTENANCE#######################
#############################################################
If the site should still be avialable for one or more specific IPs replace "123.123.123.123" with the public ip of your gateway. You can also add more of these lines, just one for every ip you want to exclude from the downtime message.
PHP Code
You will also have to add a PHP file (called down.php in this case) which generates the actual downtime message.
<?php
header("HTTP/1.1 503 Service Unavailable");
echo "<h1>This service is currently down for maintenance reasons. Please check back shortly.</h1>";
?>
Force SSL
If your server has SSL support and you want SSL to be forced for the admin section then use the following snippet to do so. It's also possible to force SSL for the whole page by modifying the first RewriteCond.
#############################################################
# force ssl for the admin
#############################################################
RewriteCond %{REQUEST_URI} ^/*admin/*
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*) https:
Add Comment