.htaccess 允许各种内容类型
.htaccess allow all sorts of content types
我的 public_html 文件夹中有一个 .htaccess,它只允许特定的内容类型,该部分如下所示:
# BAD Content Type ^
# Denies any POST request with a content type other than application/x-www-form-urlencoded|multipart/form-data
RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{HTTP:Content-Type} !^(application/x-www-form-urlencoded|multipart/form-data.*(boundary.*)?)$ [NC]
RewriteRule .* - [F,NS,L]
我有一个子域,它应该允许各种内容类型(因为外部 post 方法)。
所以我想知道如何告诉 .htaccess 我的子域不应该被阻止。
我怎样才能做到这一点?
只需使用 %{HTTP_HOST}
变量添加另一个 RewriteCond
:
RewriteCond %{HTTP_HOST} !^subdomain\. [NC]
RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{HTTP:Content-Type} !^(application/x-www-form-urlencoded|multipart/form-data.*(boundary.*)?)$ [NC]
RewriteRule .* - [F,NS,L]
我的 public_html 文件夹中有一个 .htaccess,它只允许特定的内容类型,该部分如下所示:
# BAD Content Type ^
# Denies any POST request with a content type other than application/x-www-form-urlencoded|multipart/form-data
RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{HTTP:Content-Type} !^(application/x-www-form-urlencoded|multipart/form-data.*(boundary.*)?)$ [NC]
RewriteRule .* - [F,NS,L]
我有一个子域,它应该允许各种内容类型(因为外部 post 方法)。 所以我想知道如何告诉 .htaccess 我的子域不应该被阻止。 我怎样才能做到这一点?
只需使用 %{HTTP_HOST}
变量添加另一个 RewriteCond
:
RewriteCond %{HTTP_HOST} !^subdomain\. [NC]
RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{HTTP:Content-Type} !^(application/x-www-form-urlencoded|multipart/form-data.*(boundary.*)?)$ [NC]
RewriteRule .* - [F,NS,L]