web.config iis7.5 配置

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!--
rule 节点即为每个重写规则,match 节点为伪静态的规则;ignoreCase 是忽略大小写;action 是响应的URL,即真正的URL;appendQueryString 为是否跟参数。添加多个rule 时,注意name 名称应该保持不同。
问号(?)需要用转义符 如: \?
在IIS6 里如果跟参数的话使用$ 字符,在IIS7 使用{R:数字}代替$ 字符。至于多个参数时,别忘记使用&amp; 替换& 符号


文件中设置了只允许http://www.www.com、调用网站的rar、zip类型的文件,
若来源并非以上三个网站则网页返回至404.htm。对于图片等其他文件同样适用,可以根据自己的需要进行修改




<rule name="Prevent hotlinking">
<match url="^.*\.(css|js)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.baidu.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://www.youdao.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://www.sougou.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://www.google.com/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/error404.html" />
</rule>-->
<!--<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^gxpump.com$" />
</conditions>
<action type="Redirect" url="http://www.gxpump.com/{R:0}" redirectType="Permanent" />
</rule>-->
<rule name="taobao02" stopProcessing="true">
<match url="^([\u4E00-\u9FA5|\w|\*|\@|\#|\!]*)$" ignoreCase="true" />
<action type="Rewrite" url="index1.php" />
</rule>



</rules>
</rewrite>




<defaultDocument>
<files>
<clear />
<add value="index1.php" />
<add value="index.html" />
</files>
</defaultDocument>



<!--<customErrors mode="RemoteOnly" defaultRedirect="Error.aspx">
<error statusCode="403" redirect="error404.html" />
<error statusCode="404" redirect="error404.html" />
</customErrors>
404配置-->
<httpErrors errorMode="DetailedLocalOnly">
<remove statusCode="404" />
<error statusCode="404" path="/error404.html" responseMode="ExecuteURL" />
<remove statusCode="403" />
<error statusCode="403" path="/error404.html" responseMode="ExecuteURL" />
<remove statusCode="500" />
<error statusCode="500" path="/error404.html" responseMode="ExecuteURL" />
</httpErrors>






</system.webServer>
</configuration>






<!--


301 配置
IIS 7.5中的301永久重定向配置方法网上查了好几种方法,乱七八糟,下面贴出最简单的方法,当然这些需要你安装微软提供的rewrite模块。
修改web.config配置文件,
上面这段是实现URL标准化有利于SEO的
,下面那段就是临时添加个url进行跳转的方法,这个方法做淘宝客什么的,目标地址如果有变更,只需要在配置里简单修改一下既可,当然如果你url特多,
你也可以安装一个短url系统,对于只有极个别跳转的,这样简单配置一下比较方便。




<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^win7soft.com$" />
</conditions>
<action type="Redirect" url="http://www.win7soft.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>






<location path="share/win7_ultimate_key">
<system.webServer>
<httpRedirect enabled="true" destination="http://item.taobao.com/item.htm?id=12730969071" exactDestination="true" childOnly="true" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
-->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值