在为 Umbraco 站点键入 URL 时添加正斜杠
Adding a forward slash when typing the URL for Umbraco site
我有一个使用 Umbraco CMS 的网站。当点击网站上的链接时,url 将出现在结尾处带有正斜杠。例如www.mysite.com/home/
虽然如果我输入 URL 它会显示 www.mysite.com/home
正斜杠不见了。
有一个 URL 重写配置,但我不确定是否需要在那里或在 Web 配置中创建配置。
我在这个网站上找到了一些东西similar to my situation,但解决方案是相反的,删除正斜杠
有没有人遇到过这个问题或知道解决方案?
谢谢。
我正在使用 web.config 来做到这一点。
<system.webServer>
...
<rewrite>
<rules>
<rule name="Add trailing slash" stopProcessing="true">
<match url="(.*[^/{2,}])$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/install/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/([0-9]+).aspx" negate="true" />
<add input="{URL}" pattern="^.*\.(asp|aspx|axd|asmx|css|js|jpg|jpeg|png|gif|mp3|htm)$" negate="true" ignoreCase="true" />
<add input="{URL}" pattern="/Base" negate="true" />
<add input="{URL}" pattern="cdv=1" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}/" />
</rule>
</rules>
</rewrite>
...
</system.webServer>
我有一个使用 Umbraco CMS 的网站。当点击网站上的链接时,url 将出现在结尾处带有正斜杠。例如www.mysite.com/home/
虽然如果我输入 URL 它会显示 www.mysite.com/home
正斜杠不见了。
有一个 URL 重写配置,但我不确定是否需要在那里或在 Web 配置中创建配置。
我在这个网站上找到了一些东西similar to my situation,但解决方案是相反的,删除正斜杠
有没有人遇到过这个问题或知道解决方案?
谢谢。
我正在使用 web.config 来做到这一点。
<system.webServer>
...
<rewrite>
<rules>
<rule name="Add trailing slash" stopProcessing="true">
<match url="(.*[^/{2,}])$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/install/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/([0-9]+).aspx" negate="true" />
<add input="{URL}" pattern="^.*\.(asp|aspx|axd|asmx|css|js|jpg|jpeg|png|gif|mp3|htm)$" negate="true" ignoreCase="true" />
<add input="{URL}" pattern="/Base" negate="true" />
<add input="{URL}" pattern="cdv=1" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}/" />
</rule>
</rules>
</rewrite>
...
</system.webServer>