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
来源: http://www.bubuko.com/infodetail-2585105.html