You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Charlie Collins <ch...@screaming-penguin.com> on 2001/08/30 21:42:58 UTC

mod_rewrite/8272: mod_rewrite disregards URI if "?" is present (ie any querystring) AND additional search after said ? is performed

>Number:         8272
>Category:       mod_rewrite
>Synopsis:       mod_rewrite disregards URI if "?" is present (ie any querystring) AND additional search after said ? is performed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Aug 30 12:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     charlie@screaming-penguin.com
>Release:        1.3.20
>Organization:
apache
>Environment:
RedHat Linux 6.2 (kernel 2.2.14)  
>Description:
Please fogive me for bothering anybody if this is a known issue or not valid for any reason. I did
as much research as possible first and can find no other commentary on a problem that I am having
with mod_rewrite and I can reproduce on different machines. 

Basically anytime I am using mod_rewrite to search for a portion of a querystring that is passed to a URI
it does not work.  I have logged the activity extensively and when the "?" is present in a 
URI that is being searched it does not even show the real URI in the rewrite log. 

Note that this DOES NOT HAPPEN if I search for the first part of the URI before the 
qyestion mark (?) and querystring and just say give me all of said URI. 

For Example:
URL:     http://foo?page=3&param=2
Rule:    RewriteRule ^/foo(.*)  http://somewhere/foo$1

this works great even when a querystring is present such as this example URI

however if I search for a specific parameter in the querystring the same URI which
previously registered a hit via mod_rewrite and got redirected is now ignored. 

For Example:
URL:     http://foo?page=3&param=2
Rule:    RewriteRule ^foo(.+)page=3(.*)  http://somewhere/foo$1page=3$2

this does NOT WORK and again the rewrite log shows the URI as everything UP TO the 
? and then it passes every the rule and is not touched.  However in this same example
if I simply remove the question mark (?) from the URI it DOES get redericted and the rewrite
log clearly shows the rule catching the parameter.  

I have tried the rules in many different forms all with the same result (yes, I have 
escaped the ? also, such as ^foo\?(.*)page=3(.*) with the same result.)  I have used 
the same regexp expressions in other formats and they work (sed.)  


This problem only happens when searching for a parameter in the querystring of the URI, if the 
entire querystring is matched it is not an issue.
>How-To-Repeat:

>Fix:

>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!     ]