站長俱樂部:站长论坛

站長俱樂部:站长论坛 (http://www.webmasterclub.org/index.php)
-   搜尋引擎綜合討論 (http://www.webmasterclub.org/forumdisplay.php?f=18)
-   -   網頁轉址(redirect) (http://www.webmasterclub.org/showthread.php?t=104)

543 2006-01-09 03:54 AM

網頁轉址(redirect)
 
當你要將網頁搬家的時候,必須要十分小心,雖然說只要在原網址加上轉址(redirect)功能,一般訪客就可以順利進入你的新網頁,但如果小細節沒注意到,卻容易造成搜尋引擎的誤會,輕則舊網頁的排名無法順利轉移到新網頁,重則整個網站會被視為spam而遭封殺!


常用的轉址方式有三種: 301 redirect, 302 rediretc 以及 meta fresh.

301 redirect:
301代表永久轉址(permanently moved),這是對SEO最安全的轉址方式,只要不是暫時搬移的情況,都建議使用301來做轉址.

.htaccess作法:

網頁轉址
RedirectPermanent /old-file-name.html http: //www.new-domain.com/new-directory/new-file-name.html

目錄轉址
RedirectPermanent /old-directory http: //www.new-domain.com/new-directory/

全站轉址
RedirectPermanent / http: //www.new-domain.com/


php作法:

PHP 代碼:

< ?php
header
("Status: 301 Moved Permanently"false301);
header("Location: http://www.new-domain.com/new-directory/new-file-name.html");
exit();
?> 

302 redirect:
302代表暫時轉址(temporary),容易被搜尋引擎容易誤判為spam而遭到懲罰.建議不要使用.

.htaccess作法:

網頁轉址
Redirect /file-name.html http: //www.domain.com/temporary-directory/temporary-file-name.html

目錄轉址
Redirect /directory http: //www.domain.com/temporary-directory/

全站轉址
Redirect / http: //www.temporary-domain.com/


php作法:

PHP 代碼:

< ?php
header
("Location: http://www.domain.com/temporary-address/temporary-file-name.html");
exit();
?> 

meta fresh:
藉由網頁中的meta指令,於特定時間後重新導向到新的網頁,如果延遲的時間太短(約3秒之內),會被判斷為spam,若必須採用meta fresh的方式時,請勿將延遲時間設定太短.

HTML 代碼:

<HTML>
<HEAD>

<META HTTP-EQUIV=refresh" CONTENT="停留的秒數;URL=要轉的URL">

</HEAD>
<BODY>

</BODY>
</HTML>



所有時間均為 +8。現在的時間是 06:27 PM

Powered by vBulletin® 版本 3.8.4
版權所有 ©2000 - 2024,Jelsoft Enterprises Ltd.