Apache:Bloqueando o acesso a um site pelo Horario: Difference between revisions

From Wiki
(New page: 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''' ''...)
 
No edit summary
Line 21: Line 21:


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...
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]]
*[[Apache HTTP Server|  Mais Artigos sobre Apache HTTP Server]]
[[Category:Apache HTTP Server]]

Revision as of 20:10, 4 February 2013

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, >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