Http狀態碼301和302概念簡單區別


1、什么是301重定向?

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

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

 

2、什么是302重定向?

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

 

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

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

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

 

4、常見網站的應用案例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[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
 
 
b(字節)  kb(千字節)   mb (兆字節)  gb
 
1.廠商硬盤計算換算單位
1kb=1000b
1mb=1000kb
1gb=1000mb
250gb=250*1000mb=250*1000*1000kb=250*1000*1000*1000b
 
2.操作系統計算換算單位
1kb=1024b
1mb=1024kb
1gb=1024mb
250*1000*1000*1000 (字節)
250*1000*1000*1000/(1024*1024*1024)
 
3、計算:
[root@oldboy ~] # echo "250*1000*1000*1000/(1024*1024*1024)" |bc
232
[root@oldboy ~] # awk 'BEGIN{ print 250*1000*1000*1000/(1024*1024*1024) }' 
232.831
[root@oldboy ~] # awk 'BEGIN{ print 250*1000^3/1024^3 }' 
232.831

從MySQL全庫備份中恢復某個庫和某張表

 

從全庫備份中抽取出t表的表結構

 

[root@HE1 ~]# sed -e'/./{H;$!d;}' -e 'x;/CREATE TABLE `t`/!d;q' dump.sql

 

 

 

DROP TABLE IF EXISTS`t`;

 

/*!40101 SET@saved_cs_client     =@@character_set_client */;

 

/*!40101 SETcharacter_set_client = utf8 */;

 

CREATE TABLE `t` (

 

  `id` int(10) NOT NULL AUTO_INCREMENT,

 

  `age` tinyint(4) NOT NULL DEFAULT '0',

 

  `name` varchar(30) NOT NULL DEFAULT '',

 

  PRIMARY KEY (`id`)

 

) ENGINE=InnoDBAUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

 

/*!40101 SETcharacter_set_client = @saved_cs_client */;

 

 

 

從全庫備份中抽取出t表的內容

 

[root@HE1 ~]# grep'INSERT INTO `t`' dump.sql

 

INSERT INTO `t`VALUES (0,0,''),(1,0,'aa'),(2,0,'bbb'),(3,25,'helei');

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM