RewriteCond為條件,多域名時(shí)多復(fù)制一行即可
iis6規(guī)則
在主機(jī)面板-網(wǎng)站基本功能中,點(diǎn)擊isapi篩選器,點(diǎn)擊第二個(gè)按鈕”開啟自定義url偽靜態(tài)支持”,然后通過文件管理進(jìn)入
others/discuz/httpd.conf中,強(qiáng)兩行保留,其余代碼刪除,并復(fù)制以下代碼到該文件中保存即可
RewriteCond %{HTTP:Host} ^xxxx1.com$?[NC]
RewriteCond %{HTTP:Host} ^xxxx2.com$?[NC]
RewriteRule (.*) http://www.xxxx1.com$1 [NC,R=301]
實(shí)現(xiàn)的效果是xxxx1.com和xxxx2.com訪問時(shí)跳轉(zhuǎn)到www.xxxx1.com
iis7規(guī)則
在主機(jī)面板-文件管理,進(jìn)入wwwroot,新建一個(gè)文件,命名web.config,復(fù)制一些規(guī)則,保存即可
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”301Redirect” stopProcessing=”true”>
<match url=”(.*)” />
<conditions logicalGrouping=”MatchAny”>
<add input=”{HTTP_HOST}” pattern=”^xxxx1.com$” />
<add input=”{HTTP_HOST}” pattern=”^xxxx2.com$” />
</conditions>
<action type=”Redirect” url=”http://www.xxxx1.com/{R:0}” redirectType=”Permanent” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
實(shí)現(xiàn)的效果是xxxx1.com和xxxx2.com訪問時(shí)跳轉(zhuǎn)到www.xxxx1.com
其中三五互聯(lián)的虛機(jī)主機(jī),已開發(fā)“301”轉(zhuǎn)向功能,可快捷設(shè)置,相對(duì)手工設(shè)置,管理更簡(jiǎn)單便捷。三五互聯(lián)虛機(jī)主機(jī)鏈接:http://www.shinetop.cn/services/webhosting/