Received: (qmail 37908 invoked by uid 501); 8 Nov 2001 23:49:14 -0000 Message-Id: <20011108234914.37906.qmail@apache.org> Date: 8 Nov 2001 23:49:14 -0000 From: Greg Kresko Reply-To: Greg.Kresko@nrc.ca To: submit@bugz.apache.org Subject: RewriteRule omitting "/" in modified "include virtual" path X-Send-Pr-Version: 3.110 >Number: 8717 >Category: mod_include >Synopsis: RewriteRule omitting "/" in modified "include virtual" path >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Nov 08 15:50:00 PST 2001 >Closed-Date: Fri Nov 09 05:31:00 PST 2001 >Last-Modified: Fri Nov 09 05:31:00 PST 2001 >Originator: Greg.Kresko@nrc.ca >Release: 1.3.20 >Organization: >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 ''. The virtual host is defined by: ServerName productxxx.com DocumentRoot /html/xxx ServerPath /xxx/ RewriteEngine on RewriteRule ^/xxx/(.*) /$1 [L,R] 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: State-Changed-From-To: open-closed State-Changed-By: slive State-Changed-When: Fri Nov 9 05:31:00 PST 2001 State-Changed-Why: mod_include subrequests are not going to follow an external redirect. Try removing the [R] from your RewriteRule. This question is more appropriate for a user mailing list or newsgroup. Thanks for using Apache! >Unformatted: [In order for any reply to be added to the PR database, you need] [to include 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! ]