【发布时间】:2011-06-08 04:40:00
【问题描述】:
我正在尝试使用 URL 重写模块在 iis 7 中为我的站点设置重写规则。如果站点名称是“WonderfulWidgets”
我希望它始终是 http://WonderfulWidgets.com。
不是:wonderwidgets.com
不是:WONDERFULWIDGETS.com
我还希望 WonderfulWidgets.com 之后的所有内容都为小写。
IE WonderfulWidgets.com/best-widgets。
我已经完成了小写 url 的重写,我也做到了,所以它会删除 WonderfulWidgets.com 之前的所有前导 www
我的问题是我的小写 URL 重写也降低了域名。 我需要帮助编写 CamelCase 域名,以便将其他所有内容重写为小写。
这是我的 web.config 中的内容:
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^WonderfulWidgets\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://WonderfulWidgets.com/{R:1}" />
</rule>
<rule name="RemoveTrailingSlashRule1" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}" />
</rule>
<rule name="Default Document URL Rewrite" stopProcessing="true">
<match url="(.*?)/?Default\.aspx$" />
<action type="Redirect" url="{R:1}/" />
<conditions>
<add input="{URL}" pattern="WebResource.axd" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
【问题讨论】:
标签: iis url-rewriting