您当前位置:知识库 >虚拟主机 >虚拟主机常见问题及技术支持 >浏览文章

多域名重定向到一个站点

来源:不详 日期:2019/8/27 9:05:44 阅读量:(0)

ABC.com

www.feedoo.cn

www.feedoo.cn

ABC.cn

ABC.net

上面五个都重定向到

www.feedoo.cn


IIS7以上可直接添加在web.config配置文件里面实现

<configuration>

   <system.webServer>

 <rewrite>

            <rules>

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

                <match url=".*" />

                <conditions>

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

                </conditions>

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

                </rule>

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

                <match url=".*" />

                <conditions>

                <add input="{HTTP_HOST}" pattern="^ABC.net$" />

                </conditions>

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

         </rule>

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

                <match url=".*" />

                <conditions>

                <add input="{HTTP_HOST}" pattern="^ABC.cn$" />

                </conditions>

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

         </rule>

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

                <match url=".*" />

                <conditions>

                <add input="{HTTP_HOST}" pattern="^www.ABC.net$" />

                </conditions>

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

         </rule>

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

                <match url=".*" />

                <conditions>

                <add input="{HTTP_HOST}" pattern="^www.ABCcn$" />

                </conditions>

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

                </rule>

            </rules>

        </rewrite>

       <httpRedirect enabled="false" destination="http://www.feedoo.cnABC.com" exactDestination="true" httpResponseStatus="Permanent" />

   </system.webServer>

</configuration>



解析设置:

第1种实现方式:记录类型为A记录,记录值为IP地址 主机记录为@和WWW

第2种方式:如果买的是虚拟主机,一般在虚拟主机的具体信息上,可以查到别名,把服务商提供的这个别名做为记录值,记录类型为cname,主机记录为@和WWW,也可以实现


  • TOP