返回首页


这里列出的IIS 7及以上的最常见的URL重写规则。删除结尾的斜线规则

<rule name="Remove Trailing Slash Rule">

      <match url="(.*)/$" />

      <conditions>

        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

      </conditions>

      <action type="Redirect" redirectType="Permanent" url="{R:1}" />

</rule>

此规则将匹配所有URL,用斜线结束,删除的斜线,并返回一个永久性响应给客户端重定向。删除的WWW。{C}
此规则将匹配所有"WWW开头的网址??和重定向到赤裸裸的域名网址,同时保留任何查询字符串的URL路径。手动%,你必须输入你的规则中的域名。防止图像盗链
<rule name="Prevent image hotlinking">

      <match url=".*\.(gif|jpg|png)$" />

      <conditions>

        <add input="{HTTP_REFERER}" 

          pattern="^$" negate="true" />

        <add input="{HTTP_REFERER}" 

          pattern="^http://Example\.com/.*$" negate="true" />

      </conditions>

      <action type="Rewrite" 

        url="/images/say_no_to_hotlinking.jpg" />

</rule>

此规则将匹配URL的结尾的。GIF,JPG,或PNG,并检查您的域名的Referer头,如果请求不是从您的域名,那么它将返回??em>的say_no_to_hotlinking JPG??关于谷歌机器人和其他搜索引擎知道,你可能想,让他们热链接到你的图像。

回答

评论会员:游客 时间:2012/02/07
Monjurul哈比卜|不错的工作
supriya chaladi
评论会员:我的票5 时间:2012/02/07