I have built a website (PHP) with more than 60 pages. I have only now realized (unfortunately) that I should have built in an \"In Maintenance Mode\" feature to allow an adm
I think, standard Apache expressions are more easily to understand than rewrite rules.
Before maintenance I rename file /home/coolcmd/site_maintenance_off to /home/coolcmd/site_maintenance_on.
Code snippet for /.htaccess:
# If file, directory or symlink /home/coolcmd/site_maintenance_on exists,
# and requested file is not /maintenance.html,
# and not an admin's IP...
# Generate status code 503 for URL beginning with /, in other words for ANY URL.
# This is not "the real redirection 3xx".
Redirect 503 "/"
# This page handles status code 503. All external resources used by page
# (for example, maintenance.css), if any, must be added to above.
ErrorDocument 503 /maintenance.html
# Maintenance probably will end in 10 minutes.
Header set Retry-After 600