马春杰杰 Exit Reader Mode

[mcj]IIS服务器利用web.config进行整站301重定向

在根目录新建web.config文件,然后输入:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer> 
    <rewrite>
      <rules>
	  
        <rule name="b1y 301 Redirect" stopProcessing="true">
          <match url=".*" />
          <conditions>
          <add input="{HTTP_HOST}" pattern="^111.67.200.12$" />
          </conditions>
          <action type="Redirect" url="http://18.139.38.19/{R:0}"
          redirectType="Permanent" />
        </rule>
		
        <rule name="news_show301" stopProcessing="true">
          <match url=".*" />
          <conditions>
          <add input="{HTTP_HOST}" pattern="^111.67.200.12$" />
          </conditions>
          <action type="Redirect" url="http://18.139.38.19/{C:1}.html"           appendQueryString="false" redirectType="Permanent" />
        </rule>
	  		
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

 

本文最后更新于2019年5月22日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!