On Fri, Jun 26, 2015 at 4:12 PM, James Moe <ji...@sohnen-moe.com> wrote:

>   That is how our current shopping cart generates an URL to locate a
> page. It is completely predictable. I wish to match the Query String
> exactly as a string; I do not care about names and values.
>   We are transitioning to another e-commerce service. I want to have
> the current store category URLs and a select number of product URLs
> re-directed to the new site's corresponding locations. Hence the
> rewrite rule.


Works for me. I added

RewriteCond %{QUERY_STRING} app=ecom&ns=catshow&ref=books
RewriteRule ^ /forbidden.php [END,E=error-notes:qstring-matched]

to my config and did a "apachectl graceful". I then did

curl -v 'http://localhost/?app=ecom&ns=catshow&ref=books' > x

and received my expected  403 /forbidden.php output. If I repeat the curl
command with a single character changed in the query string it no longer
matches that rewrite rule and I get the index page for my server. So I
submit to you that either the query string is not in the form you expect or
there is something else wrong with your configuration. For example, perhaps
you have the rewrite rule in the wrong container (i.e., server, location,
directory, virtual host).

P.S., If you want to match the query string literally rather than as a
pattern which matches a subset of the query string you should preface the
pattern with an equal-sign:

RewriteCond %{QUERY_STRING} =app=ecom&ns=catshow&ref=books


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

Reply via email to