【问题标题】:URL Rewrite: Rewrite URL with unexisting PathURL 重写:用不存在的路径重写 URL
【发布时间】:2015-07-31 13:16:12
【问题描述】:

我目前有一个网址:

http://someDomain.com/SomeVirtualDirectory/SomeDb/SomeFileID

我很乐意重写

http://someDomain.com/SomeVirtualDirectory/Get.aspx?page={REQUEST_URI}" 

我目前使用的是以下Inbound Rule

        <rule name="CatchAll" stopProcessing="true">
          <match url=".*" />
          <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Redirect" url="http://someDomain.com/SomeVirtualDirectory/Get.aspx?page={REQUEST_URI}" logRewrittenUrl="true" />
        </rule>>

我注意到似乎没有发生重写(使用 Fiddler 等...)。知道是否可以使用URL Rewrite 如果服务器上不存在路径(在这种情况下为SomeDb/SomeFileID)?

感谢您抽出宝贵时间,祝您周末愉快

【问题讨论】:

    标签: asp.net .net iis url-rewriting


    【解决方案1】:

    幸运地找到了解决方案:

            <rule name="CatchAll" stopProcessing="false">
              <match url=".*" />
              <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="Get.aspx?page={R:0}" logRewrittenUrl="true" />
            </rule>
    

    我希望它可以对某人有所帮助。 Rewrite 不起作用的主要原因是我将 StopProcessing 设置为 true。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-27
      • 2011-12-27
      相关资源
      最近更新 更多