title: Configure Apache to route "GET /user/foo" to /user/GET.php and "PUT /user/foo" to /user/PUT.php
body: <p>I would like to arrange things so that a GET request for e.g.</p>
  
  <pre><code>http://example.com/user/foo@bar.com
  </code></pre>
  
  <p>internally calls the script</p>
  
  <pre><code>/var/www/example.com/rest/user/GET.php
  </code></pre>
  
  <p>and a PUT request for the same URL internally calls the script</p>
  
  <pre><code>/var/www/example.com/rest/user/PUT.php
  </code></pre>
  
  <p>and so on for the other HTTP verbs POST and DELETE.</p>
  
  <p>It's almost possible to achieve this via the <a href="http://httpd.apache.org/docs/2.2/mod/mod_actions.html#script" rel="nofollow noreferrer">&lt;Script&gt;</a> directive, but it doesn't quite work, because "<a href="http://httpd.apache.org/docs/2.2/mod/mod_actions.html#script" rel="nofollow noreferrer">Script with a method of GET will only be called if there are query arguments present</a>".  This means that if Apache is configured via</p>
  
  <pre><code>&lt;Location /user&gt;
  Script GET /rest/user/GET.php
  Script PUT /rest/user/PUT.php
  &lt;/Location&gt;
  </code></pre>
  
  <p>then, whilst a GET request for</p>
  
  <pre><code>http://example.com/user/foo@bar.com?foo=bar
  </code></pre>
  
  <p>will call <code>GET.php</code>, if the request does not contain the query string "foo=bar", it doesn't.  </p>
  
  <p>(Also, why was <code>&lt;Script&gt;</code> designed like this in the first place?)</p>