You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by Apache Wiki <wi...@apache.org> on 2014/06/19 01:38:08 UTC

[Httpd Wiki] Update of "RewriteLog" by thumbs

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.

The "RewriteLog" page has been changed by thumbs:
https://wiki.apache.org/httpd/RewriteLog?action=diff&rev1=4&rev2=5

Comment:
Clarified the minimum usable log level. Re-organized the text based on the user's feedback.

  
  == apache HTTP server 2.4 ==
  
- Logging for mod_rewrite is now in the [[http://httpd.apache.org/docs/current/mod/core.html#errorlog|ErrorLog]], see [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#logging|logging]]
+ Logging for mod_rewrite is now achieved using the [[http://httpd.apache.org/docs/current/mod/core.html#errorlog|ErrorLog]] directive, see [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#logging|logging]] to configure the log level. A value of trace5 is recommended.
  
  == apache HTTP server 2.2 (and older) ==
  
+ === By editing your vhost ===
+ 
- Place the following directives in your vhost, if applicable. Otherwise, place them in the server context:
+ Place the following directives in your vhost, if defined in your configuration. Otherwise, place them in the server context:
  
  [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteengine|RewriteEngine]] on
  
@@ -20, +22 @@

  
  [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteloglevel|RewriteLogLevel]] 5
  
- ''Using a [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteloglevel|RewriteLogLevel]] value higher than 5 will not produce additional logging output''
+ Using a [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteloglevel|RewriteLogLevel]] value higher than 5 will not produce additional logging output and using a lower level will hide important information.
  
- ''Rewrite rules in the server context can still apply to specific vhosts if "[[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteengine|RewriteEngine]] on" and "[[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions|RewriteOptions]] inherit" is set.''
+ === By editing the Server context ===
+ 
+ Rewrite rules in the server context can still apply to specific vhosts with the following directives in each vhost:
+ 
+ [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteengine|RewriteEngine]] on
+ 
+ [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions|RewriteOptions]] inherit
+ 
+ The following directives must be placed in the Server context, in the same fashion as editing your vhost:
+ 
+ [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteengine|RewriteEngine]] on
+ 
+ [[http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog|RewriteLog]] /path/to/log
+ 
+ [[http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteloglevel|RewriteLogLevel]] 5
  
  = Recipes =
  
@@ -30, +46 @@

  
  Config:
  {{{
- RewriteLogLevel 9
  RewriteLog "||/usr/local/rewrite_log_pipe"
  }}}
- Like in a usual setup, we set `RewriteLogLevel` high enough to be verbose enough. However, instead of logging to a file, we will pipe the log through a program.
  
- This program will be a short and simple Perl script:
+ Instead of logging to a file, the output will be piped through a script:
  
  {{{#!perl
  #!/usr/bin/env perl
@@ -50, +64 @@

  }
  }}}
  
- This program opens the file `/tmp/rewrite.log`, looks for anything in the input that looks like '''(1)''' or '''(2)''' and drops everything before that.
+ This script opens the file `/tmp/rewrite.log`, looks for anything in the input that looks like '''(1)''' or '''(2)''' and drops everything before that.
  
  Before:
  
@@ -82, +96 @@

  (1) [perdir /srv/www/vhosts/hc-profi/] pass through /srv/www/vhosts/hc-profi/index.php
  }}}
  
+ In this example, 'favicon.ico' is rewritten to /index.php, then the '^test_.*$' pattern is applied to the sub-request.
+ 
+ Lastly, the same sub-request has the '^index\.php$' pattern applied to. In this case, the result was a non-match, and the rule is skipped.
+ 

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