今天所做的努力
都是在为明天积蓄力量

IIS7 301伪静态跳转

本文最后更新于2017年8月31日,已超过2427天没有更新,如果文章内容失效,请留言反馈给我们,谢谢!
强烈向大家推荐一个好网站,【我要自学网】,教程由在校老师录制,有办公会计、平面设计、室内设计、机械设计、网页编程、影视动画等教程.....让你足不出门,都可以体验学校的专业教育!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <rewrite>
            <rules>
            </rules>
        </rewrite>
   </system.webServer>
</configuration>             格式

a域名跳转到c域名       【  conditions  logical逻辑条件  Redirect 更改  】

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

                    <match url="(.*)" />

                    <conditions logicalGrouping="MatchAll">

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

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

                    </conditions>

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

                </rule>

非a域名跳转到a域名       【negate="true" 表示 

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

                <match url="(.*)" />

                <conditions logicalGrouping="MatchAny">

                    <add input="{HTTP_HOST}" pattern="^www.a.com$" negate="true" />

                </conditions>

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

           </rule>

将index.html【a】跳转到根域名,如果是目录把index.html换成目录名 【  目录<match url="^a" /> 】  【trackAllCaptures 轨道捕捉】

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

          <match url="^index.html(多个文件用|割开)" />

          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />

          <action type="Redirect" url="http://www.a.com"   />

       </rule>

将a目录及下面的所有路径跳转到根域名。【根域名/对应路径】 【  <action type="Redirect" url="http://www.a.com/b/index.html"  />

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

     <match url="^a" />

     <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />

     <action type="Redirect" url="http://www.a.com"  />

     </rule>

将a目录下所有路径跳转到对应目录下,如/a/index.html 跳转到/a/  

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

        <match url="^(.*)index.html" />

        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />

        <action type="Redirect" url="/{R:1}" />

   </rule>

过滤bbs目录不被重写  ?

在最后<action type="Redirect"前一行添加:

<add input="{REQUEST_URI}" pattern="bbs" negate="true" />

过滤css,js,gif等文件不被重写 ?

<add input="{REQUEST_URI}" pattern="(.css|.js|.gif|.png|.jpg|.jpeg|.xml)" ignoreCase="false" negate="true" />

赞(1)
未经允许不得转载:如需转载,请标注内容来源流觞 » IIS7 301伪静态跳转
分享到: 更多 (0)
强烈向大家推荐一个好网站,【我要自学网】,教程由在校老师录制,有办公会计、平面设计、室内设计、机械设计、网页编程、影视动画等教程.....让你足不出门,都可以体验学校的专业教育!
强烈向大家推荐一个好网站,【我要自学网】,教程由在校老师录制,有办公会计、平面设计、室内设计、机械设计、网页编程、影视动画等教程.....让你足不出门,都可以体验学校的专业教育!

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

今天所做的努力都是在为明天积蓄力量

联系我们关于小站