Apache::TimedRedirect - an Apache (mod_perl) TransHandler


  use Apache::TimedRedirect;

  requires TimePeriod be installed (go to nearest CPAN)
  requires Apache have mod_perl installed.

  httpd.conf entry...
  **** NOTE *** 
  CANNOT be inside <LOCATION></LOCATION> tags
  PerlTransHandler Apache::TimedRedirect
  PerlSetVar B<redirecturl> http://www.somewhere.far/
  PerlSetVar B<timewindow> 'hr {6am-8pm}'
  PerlSetVar B<uriregex> foo|bar|do or maybe \..*(foo)>
  PerlSetVar B<log> 1 
  PerlSetVar B<excludeip>


Apache::TimedRedirect is a mod_perl TransHandler module that allows the configuration of a timed redirect. In other words if someone enters a a website and the URI matches a regex AND it is within a certain time period they will be redirected somewhere else.

It was first created to 'politely' redirect visitors away from database driven sections of a website while the databases were being refreshed.


redirecturl -- the place where visitors are sent if timewindow and uriregex are true.

timewindow -- the time period(s) at which redirect should place. The format is detailed in Time::Period manpage.

uriregex a perl regex describing the URI constraints for redirection

log log info via STDERR .

excludeip host IP address (XXX.XXX.XXX.XXX) of a host that is allowed to bypass redirection. This is a literal ip not a regex.

Remember that this is embedding itself in the your Apache webserver so you should test before committing to production. We have used it with Apache 1.3.0, 1.2.5 with mod_perl 1.12 and 1.15 in medium traffic sites (400k-500k hits weekly).


Peter G. Marshall, Thanks to Patrick Ryan for Time::Period that made this a snap.

Copyright (c) 1998 Peter G. Marshall. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself


perl(1), Time::Period(3), mod_perl(1)