Patrick Conway
Patrick Conway

Reputation: 190

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?

Upvotes: 5

Views: 13643

Answers (2)

Patrick Conway
Patrick Conway

Reputation: 190

I'm using nginx now This is how its done in nginx

location  / {
    return 200 '' ;
    access_log off;
  }

Upvotes: -3

Amit Verma
Amit Verma

Reputation: 41249

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.

Upvotes: 11

Related Questions