[英]Add trailing slash to subfolder URL
I am using ASP MVC as my lanugage and I have a website with multiple subfolders/applications in it. 我使用ASP MVC作为我的语言,并且拥有一个包含多个子文件夹/应用程序的网站。
www.sample.com www.sample.com
www.sample.com/zh www.sample.com/zh
www.sample.com/en www.sample.com/en
What I need is to add a trailing slash to the end of the URL only. 我需要的是仅在URL末尾添加斜杠。
www.sample.com/zh/ www.sample.com/zh/
www.sample.com/en/ www.sample.com/en/
I am confused with the IIS rewrite parameters. 我对IIS重写参数感到困惑。 Can somebody help me?
有人可以帮我吗?
For reference, I did some modification with the rules: 作为参考,我对规则做了一些修改:
<rule name="Add trailing slash" stopProcessing="true">
<match url="^.*" />
<action type="Redirect" url="{C:0}/" appendQueryString="true" redirectType="Permanent" />
<conditions>
<add input="{PATH_INFO}" pattern="\/zh$" />
</conditions>
</rule>
This way, when /zh is encountered, it will redirect to /zh/ only,without breaking the existing urls. 这样,当遇到/ zh时,它将仅重定向到/ zh /,而不会破坏现有的url。
Hope this helps somebody! 希望这对某人有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.