title: Limit access to an URL with query parameters
body: <p>I need that an URL is accessible only for some defined users. In the URL there is a query parameter and that is the discriminator.</p>
  
  <p>The URL could be something like this:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>https://my.my.com/my-app/view/myView.xhtml?myQueryParam=allUsers
  </code></pre>
  
  <p>My experience in such apache configurations is ~ 0 and googling a little I could set up this:</p>
  
  <pre class="lang-none prettyprint-override"><code>RewriteEngine on
  RewriteCond %{QUERY_STRING} myQueryParam=allUsers
  RewriteRule "/my-app/view/myView[.]xhtml.*" - [E=no_auth_required:1]
  
  &lt;LocationMatch "/my-app/view/myView[.]xhtml.*"&gt;
  
                 Require uniqueID user1ID user2ID
  
  &lt;/LocationMatch&gt;
  </code></pre>
  
  <p>Between <code>xhtml</code> and <code>?</code> could come additional strings too, therefor the <code>.*</code>.</p>
  
  <p>This works but the problem is that it also denies the access for ex. to the link </p>
  
  <pre class="lang-none prettyprint-override"><code>https://my.my.com/my-app/view/myView.xhtml?myQueryParam=somethingElse
  </code></pre>
  
  <p>It seems that it doesn't bother the value of the query parameter...</p>
  
  <p>What do I miss?</p>
  
  <p>EDIT: I forgot to say that I use Apache 2.2.</p>