Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Time Dependant Rewriting |
|
Author |
|
amcfarlane
Joined: 19 Dec 2007 Posts: 2 Location: Somerset, UK
|
Posted: Wed 19 Dec '07 1:20 Post subject: Time Dependant Rewriting |
|
|
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 ^.*$ http://domain.com/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? |
|
Back to top |
|
amcfarlane
Joined: 19 Dec 2007 Posts: 2 Location: Somerset, UK
|
Posted: Wed 19 Dec '07 2:22 Post subject: |
|
|
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 |
|
Back to top |
|
|
|
|
|
|