小编Jaf*_*dog的帖子

如何在POST参数中使用Apache mod_rewrite rewritecond?

我知道我可以在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可以检查请求体并将检查结果加载到环境变量中吗?那会有用......

apache mod-rewrite mod-security

5
推荐指数
1
解决办法
7858
查看次数

标签 统计

apache ×1

mod-rewrite ×1

mod-security ×1