Apache Solutions - Time-Dependent Rewriting & Host Deny From

Posted on Sunday, October 10, 2004 @ 01:50:26 UTC in Apache
by Raven

These are from the Apache Mod Rewrite Guide. These are killer scripts in my estimation. Enjoy!!

- Time-Dependend Rewriting

Description:
When tricks like time-dependend 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?
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-dependend 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

- Host Deny Using External File

Description:
How can we forbid a list of externally configured hosts from using our server?
Solution:
RewriteEngine on
RewriteMap hosts-deny txt:/path/to/hosts.deny
RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^/.* - [F]
 
 
click Related        click Share
 
 

Re: Apache Solutions - Time-Dependent Rewriting & Host Deny From (Score: 1)
by beetraham (beetraham@ec-clan.org) on Sunday, October 10, 2004 @ 11:27:58 UTC

(User Info | Send a Message)

Marvellous!

At least to me, this opens up all new possibilities regarding *.htaccess* utilization being incorporated with "Google Tapped" PHP-Nuke Modules - i.e. timed control of PHP-Nuke Modules. This is awesome!

Re: Apache Solutions - Time-Dependent Rewriting & Host Deny From (Score: 1)
by Raven
(raven (_AT_) ravenphpscripts (_DOT_) com) on Sunday, October 10, 2004 @ 12:39:40 UTC
(User Info | Send a Message)

And also timed control for site maintenance! How about giving a user a timed control access to a module he's intereted in buying :wink: ?

 
News ©

Site Info

Last SeenLast Seen
  • vashd1
  • ofigustavo
Server TrafficServer Traffic
  • Total: 482,342,787
  • Today: 26,989
Server InfoServer Info
  • Apr 19, 2024
  • 06:59 pm UTC