httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Wagner" <aar...@technologist.com>
Subject Re: [users@httpd] Restricting access to a directory by time of day?
Date Mon, 08 Jan 2007 18:58:44 GMT
http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html

>>>>>>>snip<<<<<
Time-Dependent Rewriting Description:

When tricks like time-dependent content should happen a lot of webmasters
still use CGI scripts which do for instance redirects to specialized pages.
How can it be done via
mod_rewrite<http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html>
?
Solution:

There are a lot of variables named TIME_xxx for rewrite conditions. In
conjunction with the special lexicographic comparison patterns <STRING,
>STRING and =STRING we can do time-dependent redirects:

RewriteEngine on
RewriteCond   %{TIME_HOUR}%{TIME_MIN} >0700
RewriteCond   %{TIME_HOUR}%{TIME_MIN} <1900
RewriteRule   ^foo\.html$             foo.day.html
RewriteRule   ^foo\.html$             foo.night.html

This provides the content of foo.day.html under the URL foo.html from
07:00-19:00 and at the remaining time the contents of foo.night.html. Just a
nice feature for a homepage...

>>>>>>><<<<<<<
On 1/8/07, Alan Corey <alancorey@yahoo.com> wrote:
>
> I've searched a little but didn't find anything.
>
> I'm thinking about putting something online that may use a bit of
> bandwidth, so
> I'd like to retrict access to times when the office isn't open.  Ideally,
> I'd
> like to have a page displayed to people who try to hit the page explaining
> the
> situation.
>
> I could do this with some combination of cron jobs and scripts (OS is
> OpenBSD)
> but I wondered if there was a way to make it a property of a <Directory />
> in
> the httpd.conf file.  Or some other nice built-in way that doesn't resort
> to
> replacing httpd.conf and restarting Apache twice a day.
>
> Thank you,
>
>   Alan
>
> Still using an operating system that gets viruses, costs money, insults
> your intelligence, and then accuses you of stealing it?  Why?
> www.openbsd.org
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 
Thanx
Aaron N Wagner

Herbert Hoover -
"About the time we can make the ends meet, somebody moves the ends."

Mime
View raw message