I would like to arrange things so that a GET request for e.g.
http://example.com/user/[email protected]
internally calls the script
/var/www/example.com/rest/user/GET.php
and a PUT request for the same URL internally calls the script
/var/www/example.com/rest/user/PUT.php
and so on for the other HTTP verbs POST and DELETE.
It's almost possible to achieve this via the <Script> directive, but it doesn't quite work, because "Script with a method of GET will only be called if there are query arguments present". This means that if Apache is configured via
<Location /user>
Script GET /rest/user/GET.php
Script PUT /rest/user/PUT.php
</Location>
then, whilst a GET request for
http://example.com/user/[email protected]?foo=bar
will call GET.php
, if the request does not contain the query string "foo=bar", it doesn't.
(Also, why was <Script>
designed like this in the first place?)