Http狀態碼301和302概念簡單區別及企業應用案例

Http狀態碼301和302的區別及企業應用案例


1、什麼是301重定向?

  301重定向/跳轉一般,表示本網頁永久性轉移到另一個地址。

    301是永久性轉移(Permanently Moved),SEO常用的招式,會把舊頁面的PR等信息轉移到新頁面;


2、什麼是302重定向?

  302重定向表示臨時性轉移(Temporarily Moved ),當一個網頁URL需要短期變化時使用。


3、301重定向與302重定向的區別

   301重定向是永久的重定向,搜索引擎在抓取新內容的同時也將舊的網址替換爲重定向之後的網址。

   302重定向是臨時的重定向,搜索引擎會抓取新的內容而保留舊的網址。因爲服務器返回302代碼,搜索引擎認爲新的網址只是暫時的。


4、常見網站的應用案例

[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://www.etiantian.org
200
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://etiantian.org    
200
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://baidu.com
200
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://taobao.com
302
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://qq.com    
302
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://jd.com
302
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://51cto.com
301
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code}\n" http://sina.com.cn
301

更多http狀態碼知識 請瀏覽http://oldboy.blog.51cto.com/2561410/716294


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章