Shouldn't this be a 20?
RewriteCond %{TIME_HOUR} <=10
On Thu, Mar 18, 2021 at 3:07 AM Jens Kallup <[email protected]> wrote:
> Hello,
> how can I time based open times?
> The script below seems not work.
> All pages are the same.
>
> RewriteEngine On
> LogLevel warn rewrite:trace3
>
> # ---------------------------------------------------------
> # compress file(.ext) on server side, beofre delivery ...
> # on MS-Windows; you should have the GNU-Tools installed !
> # ---------------------------------------------------------
> RewriteCond %{HTTP:Accept-encoding} gzip
> RewriteCond %{REQUEST_FILENAME}\.gz -s
> RewriteRule ^(.*)\.(css|js|txt) $1\.$2\.gz [QSA]
>
> # ---------------------------------------------------------
> # shortners ...
> # ---------------------------------------------------------
> Alias "/pub" "${APACHE_WEB}/443/pub"
> Alias "/edu" "${APACHE_WEB}/443/edu"
>
> # store variable values with dummy rewrite rules
> RewriteRule . - [E=req_scheme:%{REQUEST_SCHEME}]
> RewriteRule . - [E=http_host:%{HTTP_HOST}]
> RewriteRule . - [E=req_uri:%{REQUEST_URI}]
>
> # ---------------------------------------------------------
> # out of office time rule ...
> # from 07:00 - 20:00
> # ---------------------------------------------------------
> RewriteCond %{TIME_HOUR} >=09 [OR]
> RewriteCond %{TIME_HOUR} <=10
> RewriteRule /pub/.* - [E=HTTP_OFFICE_HEADER:1]
> RewriteRule /pub/.* - [E=HTTP_OFFICE_HEADER:0]
> RewriteRule ^$ /pub/.* [R=301,L]
>
>
> In PHP:
>
> <?php
> $office = $_SERVER['HTTP_OFFICE_HEADER'];
> $status = 0;
>
> if (strcmp($office,"0") == 0)
> $status = 0; else
> $status = 1;
> ?>
>
> Jens
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>