RewriteCond為條件,多域名時多復制一行即可

iis6規則

在主機面板-網站基本功能中,點擊isapi篩選器,點擊第二個按鈕”開啟自定義url偽靜態支持”,然后通過文件管理進入

others/discuz/httpd.conf中,強兩行保留,其余代碼刪除,并復制以下代碼到該文件中保存即可

RewriteCond %{HTTP:Host} ^xxxx1.com$?[NC]

RewriteCond %{HTTP:Host} ^xxxx2.com$?[NC]

RewriteRule (.*) http://www.xxxx1.com$1 [NC,R=301]

實現的效果是xxxx1.com和xxxx2.com訪問時跳轉到www.xxxx1.com

iis7規則

在主機面板-文件管理,進入wwwroot,新建一個文件,命名web.config,復制一些規則,保存即可

<?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>

實現的效果是xxxx1.com和xxxx2.com訪問時跳轉到www.xxxx1.com

其中三五互聯的虛機主機,已開發“301”轉向功能,可快捷設置,相對手工設置,管理更簡單便捷。三五互聯虛機主機鏈接:http://www.shinetop.cn/services/webhosting/

贊(0)
聲明:本網站發布的內容(圖片、視頻和文字)以原創、轉載和分享網絡內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。郵箱:3140448839@qq.com。本站原創內容未經允許不得轉載,或轉載時需注明出處:三五互聯知識庫 » 虛擬主機如何做301

登錄

找回密碼

注冊