You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Greg Kresko <Gr...@nrc.ca> on 2001/11/09 00:49:14 UTC

mod_include/8717: RewriteRule omitting "/" in modified "include virtual" path

>Number:         8717
>Category:       mod_include
>Synopsis:       RewriteRule omitting "/" in modified "include virtual" path
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Nov 08 15:50:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Greg.Kresko@nrc.ca
>Release:        1.3.20
>Organization:
apache
>Environment:
IRIX64 wolf 6.5 6.5.11f 01101245 IP27
MIPSPro C compiler 7.3.1.2m
>Description:
The problem actually involves interaction of mod_rewrite with mod_include.  

Background:  The main server document root is "/html".  
The URL "http://mydomain.com/xxx/doc.shtml" would serve file "/html/xxx/doc.shtml".
I have defined a virtual host "productxxx.com" with document root "/html/xxx".  
The same document can now be reached as "http://productxxx.com/doc.shtml".

The problem:  Within doc.shtml are references such as 'SRC="/xxx/image/prod.gif"'  
and '<!--#include virtual="/xxx/header.html" -->'.  The virtual host is defined 
by:  

<VirtualHost *>  
ServerName productxxx.com  
DocumentRoot /html/xxx  
ServerPath /xxx/  
RewriteEngine on  
RewriteRule ^/xxx/(.*) /$1 [L,R]  
</VirtualHost>  

The image references are being properly converted (from the access_log):  

132.246.156.20 - - [08/Nov/2001:17:43:24 -0500] "GET /xxx/images/prod.gif HTTP/1.0" 302 294 "http://productxxx.com/doc.shtml" "Mozilla/4.76C-SGI [en] (X11; I; IRIX 6.5 IP20)" "productxxx.com"  
132.246.156.20 - - [08/Nov/2001:17:43:25 -0500] "GET /images/prod.gif HTTP/1.0" 200 1301 "http://productxxx.com/doc.shtml" "Mozilla/4.76C-SGI [en] (X11; I; IRIX 6.5 IP20)" "productxxx.com"  

but the SSI is not (from the error_log):  

[Thu Nov  8 17:43:22 2001] [error] [client 132.246.156.20] File does not exist: /html/xxxheader.html
[Thu Nov  8 17:43:22 2001] [error] [client 132.246.156.20] unable to include "/xxx/header.html" in parsed file /html/xxx/doc.shtml  

The file reference should be "/html/xxx/header.html", but a "/" is missing.  

I know I could correct this by removing "/xxx" everywhere, but I was hoping  
to be able to use "http://mydomain.com/xxx/doc.shtml" and  
"http://productxxx.com/doc.shtml" during a transition period.  
(The URLs and log entries have been modified to simplify the discussion.)
>How-To-Repeat:
The real URLs for the above are:  
  http://www.nrc.ca:1200/ccbfc/site_E.shtml  
and
  http://www.ccbfc.org:1200/site_E.shtml  
>Fix:
I have tried various versions of the RewriteRule, using "//$1", "\/$1", "/./$1".  
It appears as though the include processing is "cleaning" the URL after the 
rewrite and dropping the "/".
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]