Re: ReDirect question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 26, 2015 at 4:12 PM, James Moe <jimoe@xxxxxxxxxxxxxx> 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

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux