Loading
0

web.config各种跳转规则大全-持续更新
被墙跳转TG:@qianhenetwork QQ 851617266

301免备案跳转微信公众号
腾讯云服务器大促销。
华为服务器

从不带www的域名跳转到带www的域名:

<system.webServer>
  <rewrite>
    <rules>
      <rule name="301Redirect_fengjienet" stopProcessing="true">
        <match url="(.*)" />
        <conditions logicalGrouping="MatchAny">
          <add input="{HTTP_HOST}" pattern="^abc\.com$" />
          <add input="{HTTP_HOST}" pattern="^abc\.gotoip4\.com$" />
        </conditions>
        <action type="Redirect" url="http://www.tag.gg/{R:0}" redirectType="Permanent" /></rule>
    </rules>
  </rewrite>
</system.webServer>

同上,取反跳转,若不是www.tag.gg则跳转到www.tag.gg

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="301Redirect_fengjienet" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="!^www.tag.gg$" />
          </conditions>
          <action type="Redirect" url="http://www.tag.gg/{R:0}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

 

匹配到某域名,跳转到某域名目录

<system.webServer>
  <rewrite>
    <rules>
      <rule name="301Redirect_fengjienet" stopProcessing="true">
        <match url=".*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="^en.tag.gg$" />
        </conditions>
        <action type="Redirect" url="http://www.tag.gg/English/{R:0}" redirectType="Permanent" /> </rule>
    </rules>
  </rewrite>
</system.webServer>

 

匹配访问到某页面,跳转到某域名

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="index" stopProcessing="true">
          <match url="^ShowNews.asp?(.*)$" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Redirect" url="http://www.tag.gg" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

 

访问到某页面跳转到某域名二

(需求: http://www.test.com/xinde.asp?ID=1538&Action=show  301跳转到http://www.test.com/?p=1170
 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="301Redirect1" stopProcessing="true">
                    <match url="xinde.asp" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="1538" />
                        <add input="{QUERY_STRING}" pattern="show" />
                    </conditions>
                    <action type="Redirect" url="/?p=575" appendQueryString="false" />
                </rule>
                <rule name="301Redirect111" stopProcessing="true">
                    <match url="xinde.asp" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="1477" />
                        <add input="{QUERY_STRING}" pattern="show" />
                    </conditions>
                    <action type="Redirect" url="/?p=1172" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


访问某页面跳转到某域名三
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="index" stopProcessing="true">
          <match url="^index.html" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Redirect" url="http://www.tag.gg" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
 

通过web.config开启站点目录浏览

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <directoryBrowse enabled="true" />
  </system.webServer>
</configuration>
 

通过web.config开启程序报错

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
  </system.webServer>
</configuration>
 

 
301免备案跳转微信公众号
华为服务器
腾讯云服务器大促销。

声明:站长码字很辛苦啊,转载时请保留本声明及附带文章链接:https://www.zfcdn.xyz/showinfo-8-309-0.html
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
上一篇:httpd.ini伪静态规则转换为ii7规则后无法使用解决方法
下一篇:iis7web.config下asp及asp.net开启显示详细报错方法