[英]IIS URL Rewrite (redirect)
我想用我的URL中的“ home”替换“ index”,例如:
www.mywebsite.com/index
应该重定向到www.mywebsite.com/home
。
www.mywebsite.com/index/contact
到www.mywebsite.com/home/contact
等。
我尝试应用此规则
<rule name="Replace index" stopProcessing="true">
<match url="(.*)(/index)(.*)" />
<action type="Redirect" url="localhost:6782/home{R:3}" />
</rule>
该规则应选择(any-string)(/index)(any-other-string)
并将其替换为localhost:6782/home{any-other-string}
但它不会执行任何操作。
这是我的问题的答案:
<rules>
<rule name="Redirect to home" stopProcessing="false">
<match url="^index(.*)" />
<action type="Redirect" url="home{R:1}" redirectType="Permanent" />
</rule>
</rules>
提示 :尝试不同的规则时,请确保清除浏览器的缓存(或使用隐身模式)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.