Apache:Bloqueando o acesso a um site pelo Horario

Já enfrentei situações onde o cliente queria limitar o acesso ao correio somente no horário de trabalho. Com o item abaixo conseguimos fazer isso

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?

Solution:

There are a lot of variables named TIME_xxx for rewrite conditions. In conjunction with the special lexicographic comparison patterns 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...

Ver também

 * Definindo a URL padrão no IBM HTTP Server Apache
 * Apache:Redirecionando para pagina de Erro
 * Apache:Redirecionando de HTTP para HTTPS
 * Linux e Unix: Ferramentas de Monitoracao e Performance
 * AWSTATS: Configurando o AWSTATS


 * Mais Artigos sobre Apache HTTP Server