Hi folks... I've been trying to figure how to use mod_rewrite to force all access of a site to a particular page during certain times. What I'm trying to do is ensure that anyone attempting to access any html document during a particular period will *only* see an off-line notice. The rules I have are: RewriteCond %{TIME_HOUR}%{TIME_MIN} >0230 RewriteCond %{TIME_HOUR}%{TIME_MIN} <0330 RewriteRule ^.*$ /offline.html [F,L] Now obviously, this doesn't work as attempting to access offline.html will itself result in a redirection taking place. Any suggestions?
To answer myself: RewriteCond %{TIME_HOUR}%{TIME_MIN} >0230 RewriteCond %{TIME_HOUR}%{TIME_MIN} <0330 RewriteCond %{SCRIPT_FILENAME} !offline\.html$ [NC] RewriteRule ^.*$ http://www.domain.tld/offline.html [R=302,L] Works for me
Why on earth would you want to do that ? That would be like letting someone into a closed store just so they can read the sign that says it's closed & then forcing them to leave.