You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jens Kallup <ka...@web.de> on 2021/03/18 07:06:52 UTC

[users@httpd] time based not working

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: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] time based not working

Posted by Nick Folino <ni...@folino.us>.
Shouldn't this be a 20?

     RewriteCond %{TIME_HOUR} <=10

On Thu, Mar 18, 2021 at 3:07 AM Jens Kallup <ka...@web.de> 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: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] time based not working

Posted by Daniel Ferradal <df...@apache.org>.
We replied to him in irc, I think he is past that but hasn't updated his
findings here.

Suggestions were check rewritelog, consider not using OR

El vie., 19 mar. 2021 14:35, Rich Bowen <rb...@rcbowen.com> escribió:

>
>
> On 3/18/21 3:06 AM, Jens Kallup 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
>
> What does the trace log say when you make the request?
>
> >
> >      # ---------------------------------------------------------
> >      # 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: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>
> --
> Rich Bowen - rbowen@rcbowen.com
> @rbowen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] time based not working

Posted by Rich Bowen <rb...@rcbowen.com>.

On 3/18/21 3:06 AM, Jens Kallup 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

What does the trace log say when you make the request?

> 
>      # ---------------------------------------------------------
>      # 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: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

-- 
Rich Bowen - rbowen@rcbowen.com
@rbowen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org