2011-06-08 98 views
0

我想在URL重写模块的iis 7中为我的网站设置重写规则。如果网站名称是“WonderfulWidgets”IIS 7的URL重写 - 驼峰域和小写的一切

我希望它永远是http://WonderfulWidgets.com
NOT:wonderfulwidgets.com
NOT: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> 

回答

3

DNS名称通常被视为不区分大小写,所以大多数(所有?)网页浏览器显示在所有小写的域名地址栏。据我所知,你不能通过改变你在HTTP响应中返回的内容来改变这种行为。

RFC 4343

按照原来的DNS设计决策,就名 查找DNS查询比较应区分大小写。

Wikipedia

域名称以区分独立的方式解释。

浏览器似乎都喜欢小写的表示。