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} " http://www.etiantian.org
200
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " http://etiantian.org    
200
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " http://baidu.com
200
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " http://taobao.com
302
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " http://qq.com    
302
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " http://jd.com
302
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " http://51cto.com
301
[root@oldboy ~]# curl -s -o /dev/null -I -w "%{http_code} " 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');

原文地址:https://www.cnblogs.com/moss_tan_jun/p/5909122.html