apache.htaccessmod-rewrite

How do you make apache return a status 200 response code on a post to a url


I want apache to return a status code of 200 in response to post requests on a specific path

e.g. /api/mypath/foo

Is this possible with a RewriteRule?


Solution

  • Try the following code in htaccess.

    RewriteEngine on
    
    RewriteCond %{THE_REQUEST} POST /api/mypath/foo [NC]
    RewriteRule ^ - [R=200]
    

    This will return the 200ok status for /api/mypath/foo if it is accessed using POST method.