【发布时间】:2014-08-20 05:54:18
【问题描述】:
今天在我的网站上工作时,我添加了一些常用的重写规则,用于将 url 转换为全小写,并在没有 url 的情况下添加尾部斜杠。
执行此操作后,我无法再访问管理器界面。登录页面的css消失了,登录时不起作用并将我重定向到主页。
我添加了一些重写规则来解决这个问题,但想知道是否有更好的方法来解决这个问题?
如果您认为这是一个可行的解决方案并希望在 Gist 中使用它们,则重写如下所示。
请注意,前 2 条规则用于在访问管理器界面时停止处理,而后两条规则只是 IIS 中的几个开箱即用的规则。最后一点。我通常有斜杠,但在使用 Piranha 时,必须强制没有尾随空格才能在登录后进入管理器界面。
<rewrite>
<rules>
<clear />
<rule name="IgnorePiranhaAreas" patternSyntax="ECMAScript" stopProcessing="true">
<match url="areas/manager" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<rule name="IgnorePiranhaManager" stopProcessing="true">
<match url="/manager" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<rule name="LowerCaseRule1" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
<rule name="RemoveTrailingSlashRule1" stopProcessing="true">
<match url="(.*)/$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}" />
</rule>
</rules>
</rewrite>
【问题讨论】:
标签: iis url-rewriting piranha-cms