Dear Wiki user,

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

The following page has been changed by noodl:
http://wiki.apache.org/httpd/RewriteVirtualHandler

The comment on the change is:
Replace incorrect (loop prone) Action suggestions

------------------------------------------------------------------------------
  
  For other handlers such as php scripts, use:
  {{{
+ RewriteEngine On
+ RewriteCond %{REQUEST_URI} !script.php
+ RewriteRule . /script.php
- <Location />
-  Action foo-action /script.php virtual
-  SetHandler foo-action
- </Location>
  }}}
  
- Note that the above requires version 2.2+
+ The purpose of the {{{RewriteCond}}} here is to avoid 
[:RewriteLooping:looping].
  
  === Map URIs corresponding to existing files to a handler instead ===
+ 
  {{{
- <Location />
+ RewriteEngine On
+ RewriteCond %{REQUEST_URI} !script.php
+ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d [OR]
+ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
+ RewriteRule . /script.php
+ }}}
+ 
+ If the existing files you wish to have handled by your script have a common 
set of file extensions distinct from that of the hander, you can bypass 
{{{mod_rewrite}}} and use instead {{{mod_actions}}}. Let's say you want all 
.html and .tpl files to be dealt with by your script:
+ 
+ {{{
-  Action foo-action /script.php
+ Action foo-action /script.php
+ AddHandler foo-action html tpl
-  SetHandler foo-action
- </Location>
  }}}
  
  === Map all URIs except those corresponding to existing files to a handler ===

Reply via email to