Rewrite-real-path

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
 
(renamed tag to directive)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
[[Category:Configuration]]
 
[[Category:Configuration]]
  
== tags ==
+
<rewrite-real-path> lets you configure the URL to filename mapping for any URL matching a regular expression.  It can be used to create aliases for URL directories that live in a different directory from the expanded .war, e.g. images or static files.
 +
 
 +
== directives ==
  
 
{|
 
{|
! tag || description
+
! directive || description
 
|-
 
|-
 
|| rewrite || directs rewrite-real-path to rewrite the URL and continue processing
 
|| rewrite || directs rewrite-real-path to rewrite the URL and continue processing
Line 19: Line 21:
 
== example ==
 
== example ==
  
The following example directs the /static URL and its children to an external directory <code>/var/www/static</code>
+
The following example directs the /images URL and its children to an external directory <code>/var/www/images</code>
  
 
   <web-app xmlns="http://caucho.com/ns/resin">
 
   <web-app xmlns="http://caucho.com/ns/resin">
 
     <rewrite-real-path>
 
     <rewrite-real-path>
       <real-path regexp='^/static' target='/var/www/static'/>
+
       <real-path regexp='^/images' target='/var/www/images'/>
 
     </rewrite-real-path>
 
     </rewrite-real-path>
 
   </web-app>
 
   </web-app>

Latest revision as of 20:23, 21 February 2006


<rewrite-real-path> lets you configure the URL to filename mapping for any URL matching a regular expression. It can be used to create aliases for URL directories that live in a different directory from the expanded .war, e.g. images or static files.

directives

directive description
rewrite directs rewrite-real-path to rewrite the URL and continue processing
regexp the regular expression matching the URL
replacement the replacement pattern for the url
real-path completes the rewriting for a real-path
target the target path

example

The following example directs the /images URL and its children to an external directory /var/www/images

 <web-app xmlns="http://caucho.com/ns/resin">
   <rewrite-real-path>
     <real-path regexp='^/images' target='/var/www/images'/>
   </rewrite-real-path>
 </web-app>
Personal tools