【问题标题】:Query string with whitespace IIS7 Redirect using Rewrite module使用 Rewrite 模块使用空格 IIS7 重定向查询字符串
【发布时间】:2012-04-02 05:14:21
【问题描述】:

需要重定向http://www.domain.com/one/two/three/four?addFilter=five&filterValue=six

http://www.domain.com/four/six-seven?showproducts=true

6 到 7 之间的 URL 上的空格 %20 有问题

<rule name="PatternRedirect" stopProcessing="true">
          <match url="one/two/three/four.*" />
          <conditions trackAllCaptures="true">
                        <add input="{QUERY_STRING}" pattern="filterValue=([a-z]+).*([a-z]+)" />
                        <add input="{HTTP_HOST}" pattern="domain.com$" />
          </conditions>
 <action type="Redirect" url="http://domain.com/womens/{C:1}-{C:2}" redirectType="Permanent" />
        </rule>

有什么想法吗?

【问题讨论】:

    标签: redirect iis-7 rewrite


    【解决方案1】:

    试试空白字符类:

    <add input="{QUERY_STRING}" pattern="filterValue=([a-z]+)\s*([a-z]+)" />
    

    【讨论】:

    • 我试过 \s* 和 [\s*] 和 (%20|\s*) 似乎都没有工作,还尝试硬编码查询字符串中的参数,即 但没有运气......请问有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-08
    • 2016-04-08
    • 2012-03-25
    • 1970-01-01
    • 1970-01-01
    • 2014-11-03
    • 2012-10-02
    相关资源
    最近更新 更多