You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Helmut Schneider <ju...@gmx.de> on 2011/12/08 11:56:39 UTC
[users@httpd] Re: IfModule *rewrite*
Mark Montague wrote:
> On December 7, 2011 16:26 , "Helmut Schneider" <ju...@gmx.de>
> wrote:
> > I put the following lines into my apache.conf (outside, before a
> > VHOST definition):
> >
> > <IfModule mod_rewrite.c>
> > RewriteEngine on
> > RewriteLog /var/www/logs/rewrite.log
> > RewriteLogLevel 2
> > </IfModule>
> >
> > (I also tried mod_rewrite and rewrite_module)
> >
> > Unfortunatly it seems it does not work.
> >
> > But if I define the same lines within a VHOST it does work.
>
> From
> https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteengine
>
> "rewrite configurations are not inherited by virtual hosts. This
> means that you need to have a |RewriteEngine on| directive for each
> virtual host in which you wish to use rewrite rules."
Do I also need to configure
RewriteLog
within the VHOST?! Is that also a "Rewrite configuration"?! Because
only setting
RewriteEngine On
does not write a logfile...
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Re: IfModule *rewrite*
Posted by Frank Gingras <fr...@gmail.com>.
On 08/12/2011 9:35 AM, Mark Montague wrote:
> On December 8, 2011 5:56 , "Helmut Schneider" <ju...@gmx.de> wrote:
>> Do I also need to configure RewriteLog within the VHOST?! Is that also a "Rewrite
>> configuration"?! Because only setting RewriteEngine On does not write a logfile...
>
> Did you read the documentation?
>
> https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteengine
>
> "Context: server config, virtual host"
> "The directive should occur only once per server config."
> "If the name does not begin with a slash ('|/|') then it is assumed to be relative to the /Server
> Root/."
>
> If you are using RewriteLog in the server context but are not seeing a log file:
>
> - What is the value you have for RewriteLogLevel? Note that it defaults to 0, but that a value of
> 0 will disable all rewrite logging regardless of whether the RewriteLog direcitve is set. To get
> rewrite logging, you not only have to set the RewriteLog directive, you also have to set
> RewriteLogLevel to something other than 0.
> - Are you looking in the right place? (Does the log file name begin with a slash?)
> - Does Apache HTTP Server have permission to open and write the log file in the place you have
> specified?
> - Are there error messages about creating/opening the log file in your web server error log file?
>
> --
> Mark Montague
> mark@catseye.org
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
Also, when using vhosts, you'll need to set RewriteOptions inherit and RewriteEngine on in each
vhost you want to apply your rules to.
Frank
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: IfModule *rewrite*
Posted by Helmut Schneider <ju...@gmx.de>.
Eric Covener wrote:
> The logging in mod_rewrite is inherited from the base server config to
> a virtualhost (which your test requests are mapped to) the same way as
> rules and conditions, with RewriteOptions +Inherit specified only.
Thanks (to all), works now.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Re: IfModule *rewrite*
Posted by Eric Covener <co...@gmail.com>.
The logging in mod_rewrite is inherited from the base server config to
a virtualhost (which your test requests are mapped to) the same way as
rules and conditions, with RewriteOptions +Inherit specified only.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: IfModule *rewrite*
Posted by Helmut Schneider <ju...@gmx.de>.
Mark Montague wrote:
> On December 8, 2011 5:56 , "Helmut Schneider" <ju...@gmx.de> wrote:
> > Do I also need to configure RewriteLog within the VHOST?! Is that
> > also a "Rewrite configuration"?! Because only setting
> > RewriteEngine On does not write a logfile...
>
> Did you read the documentation?
Sure, but I might miss the forest through the trees.
> https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteengine
Read it again, also
https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog,
still unsure.
> "Context: server config, virtual host"
> "The directive should occur only once per server config."
> "If the name does not begin with a slash ('|/|') then it is assumed
> to be relative to the /Server Root/."
>
> If you are using RewriteLog in the server context but are not seeing
> a log file:
If I specify RewriteLog within the server context it does not write the
logfile. If I specify RewriteLog within the virtual host context, it
does. RewriteLog is the only option I change, I do not touch any other
options.
> - What is the value you have for RewriteLogLevel?
2, specified in both, the server and the vhost context.
> Are you looking in the right place?
I hope so. The vhost context is just ~20 lines below the server context.
> (Does the log file name begin with a slash?)
Yes.
> - Does Apache HTTP Server have permission to open and
> write the log file in the place you have specified?
Sure. As mentioned before, when specifiying the (no doubt identical)
directive within the vhost it works like a charm.
> - Are there error messages about creating/opening the log file
> in your web server error log file?
No. But see above.
Server context:
RewriteEngine on
RewriteLog /var/www/logs/rewrite.log
RewriteLogLevel 2
Vhost context:
RewriteEngine on
#RewriteLog /var/www/logs/rewrite.log
RewriteLogLevel 2
$some_conditions_and_rules
=> Rewrite works, logging does not.
Server context:
RewriteEngine on
(#)RewriteLog /var/www/logs/rewrite.log
RewriteLogLevel 2
Vhost context:
RewriteEngine on
RewriteLog /var/www/logs/rewrite.log
RewriteLogLevel 2
$some_conditions_and_rules
=> Rewrite works, so does logging.
Also removed the "<IfModule mod_rewrite.c>" tags, no difference.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Re: IfModule *rewrite*
Posted by Mark Montague <ma...@catseye.org>.
On December 8, 2011 5:56 , "Helmut Schneider" <ju...@gmx.de> wrote:
> Do I also need to configure RewriteLog within the VHOST?! Is that also
> a "Rewrite configuration"?! Because only setting RewriteEngine On does
> not write a logfile...
Did you read the documentation?
https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteengine
"Context: server config, virtual host"
"The directive should occur only once per server config."
"If the name does not begin with a slash ('|/|') then it is assumed to
be relative to the /Server Root/."
If you are using RewriteLog in the server context but are not seeing a
log file:
- What is the value you have for RewriteLogLevel? Note that it defaults
to 0, but that a value of 0 will disable all rewrite logging regardless
of whether the RewriteLog direcitve is set. To get rewrite logging, you
not only have to set the RewriteLog directive, you also have to set
RewriteLogLevel to something other than 0.
- Are you looking in the right place? (Does the log file name begin
with a slash?)
- Does Apache HTTP Server have permission to open and write the log file
in the place you have specified?
- Are there error messages about creating/opening the log file in your
web server error log file?
--
Mark Montague
mark@catseye.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org