繁体   English   中英

URL重写:使用不存在的路径重写URL

[英]URL Rewrite: Rewrite URL with unexisting Path

我目前有一个网址:

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等...)。 是否知道如果服务器上不存在路径(在这种情况下为SomeDb/SomeFileID是否可以使用URL Rewrite

谢谢您的时间,祝您周末愉快

幸运地找到了解决方案:

        <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。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM