URLRewriteFilter阻止POST值

时间:2013-05-17 13:53:47

标签: post tuckey-urlrewrite-filter

我写过这条规则

<rule>
    <condition type="request-uri" operator="notequal">^/admin/(.*)$</condition>
    <condition type="request-uri" operator="notequal">^/(.*)(ico|gif|jpg|jpeg|png|js|css)$</condition>
    <condition type="parameter" name="route" operator="notequal"></condition>
    <condition type="method" operator='notequal'>POST</condition>
    <from>^/(.*)$</from>
    <to>/index.php?_route_=$1</to>
</rule>

但出于某种原因,当试图访问具有POST值的东西时,永远不会通过 恩。 https://mydomain.com/index.php?route=checkout/cart/add(product_id = 5此值通过POST发送)我永远不会得到product_id = 5但product_id = 0。 我的规则中缺少什么?谢谢你的时间

1 个答案:

答案 0 :(得分:1)

确定发现问题我还添加了文件中缺少的DOCTYPE

<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
    "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">

RULE

<rule match-type="regex">
    <condition type="request-uri" operator="notequal">^/admin/(.*)$</condition>
    <condition type="request-uri" operator="notequal">^/(.*)(ico|gif|jpg|jpeg|png|js|css)$</condition>
    <condition type="parameter" name="route" operator="notequal"></condition>
    <condition type="method" name="POST" operator="notequal">POST</condition>
    <from>^/([a-zA-Z-_/0-9]+)$</from>
    <to>/index.php?_route_=$1</to>
</rule>