常用的重定向方式有: 301 redirect, 302 redirect 與 meta fresh:
這里我們主要談?wù)勅绾瓮ㄟ^(guò)301 Redirect實(shí)現網(wǎng)頁(yè)重定向
* 打開(kāi)internet信息服務(wù)管理器,在欲重定向的網(wǎng)頁(yè)或目錄上按右鍵,見(jiàn)下圖
* 選中“重定向到URL”
* 在對話(huà)框中輸入目標頁(yè)面的地址
* 切記,記得選中“資源的永久重定向”
* 當然,最后要點(diǎn)擊“應用”

相比較來(lái)說(shuō),Apache實(shí)現起來(lái)要比IIS簡(jiǎn)單多了。在A(yíng)pache中,有個(gè)很重要的文件.htaccess,通過(guò)對它的設置,可以實(shí)現很多強大的功能,301重定向只是其中之一。
Redirect permanent / http://seo.highdiy.com/ ;將目錄下內容重定向到http://seo.highdiy.com/
redirect permanent /old.html http://seo.highdiy.com/new-url/ ;將網(wǎng)頁(yè)old.html內容重定向到http://seo.highdiy.com/new-url/
通過(guò)合理地配置重定向參數中的正則表達式,可以實(shí)現更復雜的匹配。有興趣的朋友可參考Apache手冊。
其他方法還有:
<? Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://seo.highdiy.com" );?>
<%@ Language=VBScript %>
<% Response.Status=”301 Moved Permanently” Response.AddHeader “Location”, ” http://seo.highdiy.com”>
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://seo.highdiy.com”);
}
</script>
配置完成后,要認真檢查一下是否正確。Internet有很多類(lèi)似的Server Header檢查工具,如Check Server Headers Tool - HTTP Status Codes Checker或本站提供的這個(gè)網(wǎng)頁(yè)重定向檢查工具。
from: http://seo.highdiy.com/index.php/seo/how-to-301-redirect/
聯(lián)系客服