如何让apache在发布到url的帖子时返回状态200响应代码



我希望apache返回200的状态代码,以响应特定路径上的发布请求

例如/api/mypath/foo

使用RewriteRule可以做到这一点吗?

在htaccess中尝试以下代码。

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

如果使用POST方法访问/api/mypath/foo,这将返回其200ok状态。

我现在正在使用nginx这就是它在nginx 中的表现

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

最新更新