Hello all, We have an API hosted on Amazon's servers (hence no control over httpd.conf), and I use mod_rewrite to translate calls in (what I believe is) a customary way. All I use is one .htaccess file located in the top directory, that contains: RewriteCond %{REQUEST_FILENAME} !^(.+)\.php$ RewriteRule ^([^/]+)/(.*)$ $1/handler.php?$2 [L,QSA] Code (markup): The idea is: - to have several versions of the API in directories located in the root directory - to direct all API calls to a single entry point, aka handler.php Problem: while everything works as expected with GET and POST requests, in the case of a PUT request the handler script is unable to retrieve the request data. If I issue a PUT request to, for instance my.api.host/v1/accounts/acc_id, then it is correctly rewritten into my.api.host/v1/handler.php?accounts/acc_id, but handler.php waits for incoming data on the php://input stream and eventually times out. I believe URL-rewriting has something to do with the problem, as a direct PUT request to my.api.host/v1/handler.php works fine, i.e. the script does read the request data as expected. It looks like nothing much for a savvy Apache user... but me, it has me baffled I'd immensely appreciate any sort of nudge that would get me out of this rut, and out of trouble at the same time because I kind of committed myself to getting it working, unaware as I was :-( Thanks a lot.
Problem lied within the client code... I'm happy nobody wasted any of their time trying to help, I would have ended up with egg all over my face
you could write a file named .htaccess at the v1 DIR and write some codes here: RewriteEngine on RewriteBase /v1/ RewriteRule ^(.*)\.html$ handler.php?c=/$1
your rule has something wrong my.api.host/v1/handler.php will be rewrited to my.api.host/v1/handler.php