我知道我可以在rewritecond中检查GET查询字符串参数,如下所示:
RewriteCond %{REQUEST_URI} ^/somepath/somepath
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} try=3
RewriteCond %{QUERY_STRING} name=([^&]*)
RewriteRule ^/somepath/somepath(.*) /otherpath/otherpath?name=%1 [R]
Run Code Online (Sandbox Code Playgroud)
如何检查请求正文中的POST参数?我听说mod_security可以做到,但我没有找到任何关于如何将mod_security与mod_rewrite一起使用的例子,如上例所示.
我打算用这样的东西来处理POST:
RewriteCond %{REQUEST_URI} ^/somepath/somepath
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^/somepath/somepath(.*) /otherpath/otherpath [PT]
Run Code Online (Sandbox Code Playgroud)
...除了我需要一个RewriteCond来检查POST参数以查看"try = 3".
modsecurity可以检查请求体并将检查结果加载到环境变量中吗?那会有用......