服務(wù)熱線
153 8323 9821
我們說不同的程序,301重寫向的方法也是不同的。
下面是IIS服務(wù)器、Apache服務(wù)器、ASP、.Net、PHP實(shí)現(xiàn)301重定向的方法。
一、IIS服務(wù)器實(shí)現(xiàn)301重定向
1、打開internet信息服務(wù)管理器,在欲重定向的網(wǎng)頁(yè)或目錄上按右鍵;
2、選中“重定向到URL”;
3、在對(duì)話框中輸入目標(biāo)頁(yè)面的地址;
4、切記,記得選中“資源的永久重定向”;
5、當(dāng)然,最后要點(diǎn)擊“應(yīng)用”。
二、Apache服務(wù)器實(shí)現(xiàn)301重定向
相比較來說,Apache實(shí)現(xiàn)起來要比IIS簡(jiǎn)單多了。在Apache中,有個(gè)很重要的文件.htaccess,通過對(duì)它的設(shè)置,可以實(shí)現(xiàn)很多強(qiáng)大的功能,301重定向只是其中之一。
redirect permanent / http://www.seoer365.com
說明:將目錄下內(nèi)容重定向到 http://www.seoer365.com
redirect permanent /301.html http:http://www.seoer365.com/bbs/
說明:將網(wǎng)頁(yè)301.html內(nèi)容重定向到 http:http://www.seoer365.com/bbs/
通過合理地配置重定向參數(shù)中的正則表達(dá)式,可以實(shí)現(xiàn)更復(fù)雜的匹配。有興趣的朋友可參考Apache手冊(cè)。
三、PHP下的301重定向方法
<? Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.seoer365.com" );?>
四、ASP下的301重定向方法
<%@ Language=VBScript %>
<% Response.Status=”301 Moved Permanently” Response.AddHeader “Location”," http://www.seoer365.com”>
五、ASP .NET下的301重定向方法
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.seoer365.com”);
}
</script>