.htaccess - apache htaccess multiple http method condition -


i'm desperately trying build rest api. therefore, created .htaccess file, should redirect request right file, depending on request method.

i managed working , post requests, wrong when try add third request method put or delete.

this htaccess (shorted):

####################### # data uris ####################### rewritecond %{request_method} =get  ##### employee # load employees rewriterule ^rest/employee$ /moduls/employee/rest/get/get_all.php  # data form specific employee rewriterule ^rest/employee/([0-9]*)$ /moduls/employee/rest/get/get.php?id=$1 # , employee sub resources # base data rewriterule ^rest/employee/([0-9]*)/base_data$ /moduls/employee/rest/get/base_data.php?id=$1 # contract data rewriterule ^rest/employee/([0-9]*)/contract$ /moduls/employee/rest/get/contract.php?id=$ ####################### # create data uris ####################### rewritecond %{request_method} =post # rest urls employee # add new employee rewriterule ^rest/employee$ /moduls/employee/rest/add.php  ####################### # edit data uris ####################### rewritecond %{request_method} =put ##### employee rewriterule ^rest/employee/([0-9]*)/base_data$ /moduls/employee/rest/edit/base_data.php?id=$1 

when start request rest/employee depends on method script executed. works fine, when try load /rest/employee/xxx/base_data using put request apache redirects me script should executed when request permitted.

i'm quite new .htaccess , can't see error :-/

i curious why decided handle routing logic in apache rather @ application layer. have single fallbackresource declaration pointing requests front controller , have front controller inspect incoming request perform routing. more flexible add more endpoints restful service.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -