On Fri, Jun 26, 2015 at 12:34 PM, Eric Covener <cove...@gmail.com> wrote:

> On Fri, Jun 26, 2015 at 3:21 PM, James Moe <ji...@sohnen-moe.com> wrote:
> > RewriteCond %{QUERY_STRING} app=ecom&ns=catshow&ref=books
> > RewriteRule ^
> >
> https://ya250.infusionsoft.com/app/storeFront/handleStoreFrontLink?displayType=Category&id=1&displayName=Books
> > [R=301,L]
>
> RewriteRule matches aginstt just the path, without the scheme host or
> query string.


That isn't the issue in this example. Notice that the rewrite rule pattern
is simply "^" which will match any path as it simply tests that the path
has a beginning (i.e., it anchors any subsequent part of the pattern to the
start of the path).

My question for James would be how do you know the query string has the
parameters in that exact order? Unless the query string has been
hand-crafted you cannot assume the parameters will appear in any specific
order. Also, your pattern doesn't handle the case where the parameters are
separated by semicolons (which is a legal alternative to ampersand). In
general matching against QUERY_STRING is very difficult to do in a robust
manner.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Reply via email to