Received: (qmail 60610 invoked by uid 501); 30 Aug 2001 19:42:58 -0000 Message-Id: <20010830194258.60609.qmail@apache.org> Date: 30 Aug 2001 19:42:58 -0000 From: Charlie Collins Reply-To: charlie@screaming-penguin.com To: submit@bugz.apache.org Subject: mod_rewrite disregards URI if "?" is present (ie any querystring) AND additional search after said ? is performed X-Send-Pr-Version: 3.110 >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: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Aug 30 12:50:00 PDT 2001 >Closed-Date: Sat Sep 01 10:40:08 PDT 2001 >Last-Modified: Sat Sep 01 10:40:08 PDT 2001 >Originator: charlie@screaming-penguin.com >Release: 1.3.20 >Organization: >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¶m=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¶m=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: State-Changed-From-To: open-closed State-Changed-By: slive State-Changed-When: Sat Sep 1 10:40:08 PDT 2001 State-Changed-Why: RewriteRule's don't match against the query string. You can instead use a RewriteCond matching against the variable %{QUERY_STRING} (if I remember correctly; check the docs for details). 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! ]