搜外网>搜外问答>问答页面

web.config 整站301重定向后 怎么再把/index.html 页面 301跳转到域名

<rule name="Redirect" stopProcessing="true">

<match url=".*" />

<conditions>

<add input="{HTTP_HOST}" pattern="^ywkjSEO.com$" />

</conditions>

<action type="Redirect" url="http://www.ywkjSEO.com/{R:0}" redirectType="Permanent" />

</rule>


如上面代码,在web.config中 采用整站301重定向了,  现在想把/index.html 页面 301跳转到域名   怎么添加代码?

追加问题
    1 人参与回答
濮阳
濮阳 · 搜你所想,搜你所问!
智迅优化 等 1 人赞同该回答

直接隐藏/ 就可以

代码

XML复制代码

 


<?xml version="" encoding="UTF-8"?>
<configuration>
   <
   <directoryBrowse enabled="false" />
   <rewrite>
      <rules>
      <rule name="OrgPage" stopProcessing="true"> 
       <match url="^(.*)$" />
       <conditions logicalGrouping="MatchAll"> 
          <add input="{HTTP_HOST}" pattern="^(.*)$" /> 
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
       </conditions> 
         <action type="Rewrite" url="{R:1}" /> 
</rule>
</rules>
    </rewrite>
    <defaultDocument>
            <files>
                <clear />
                <add value="" />
                <add value="" />
                <add value="" />
                <add value="" />
                <add value="" />
                <add value="" />
                <add value="" />
                <add value="" />
                <add value="" />
            </files>
        </defaultDocument>
        <httpErrors>
            <error statusCode="500" subStatusCode="1" prefixLanguageFilePath=""path="" 
responSEMode="ExecuteURL" />
            <error statusCode="404" subStatusCode="1" prefixLanguageFilePath="" path=""responseMode="Redirect" />
        </httpErrors>
    </
</configuration>
 

复制代码

如果只是需要去掉, 那直接把下面这段代码加到 < </中间就可以了。

XML复制代码

 


<rewrite>
<rules> 
<rule name="OrgPage" stopProcessing="true"> 
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll"> 
<add input="{HTTP_HOST}" pattern="^(.*)$" /> 
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
</conditions>
<action type="Rewrite" url="{R:1}" /> 
</rule>
</rules>
</rewrite>
 
 

复制代码

需要注意的是还要修改 设置Codeigniter的文件,该文件默认在APPlication/config目录下。这个文件中的下列内容:

PHP复制代码

 


// $config['index_page'] = ""; 把其中的 "" 改成 "" ,如下:
$config['index_page'] = "";
 

复制代码

SEO培训招生中
189