小冬SEO

web.config配置301去掉首页index.html,跳转到首页

2019-05-16 7:26:18 4447 织梦安全

iis配置伪静态或301时候,需要用到文件web.config,很多时候我们在设置了首页文件为index.html,但是任然能够打开这样的后缀,这个时候就需要我们配置301跳转,这样就不会出现重复页面,分散权重。

web.config配置将index.html301到首页的代码如下:

<rule name="Redirect010" stopProcessing="true">
<match url="^index.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://www.cdseoyh.cn" />
</rule>

其中<rule name="名称">其中的名称不能与其他文件名称相同,不然就没有效果了。

宝塔管理后台设置方法,伪静态设置最下面加入:

if ($request_uri = /index.html){
    return 301 http://www.cdseoyh.cn/; }

如图:

版权保护: 本文由小冬SEO编辑发布,转载请保留链接: http://www.myseoyh.cn/cms/dedesafe/70.html