URL规范(url normalization)

URL规范化(url normalization)其实就是一个标准化URL的过程,其实也就是将一个URL转化为一个符合规范的等价URL(如http://www.blog.com /shudo转化为http://www.blog.com/shudo/),这样程序可以确定这两个URL是等价的。
URL规范化用于搜索引擎可以减少对页面的重复索引,同时也可以减少爬虫的重复抓取。浏览器端识别用户是否访问过一个URL也需要使用URL规范化。

* 1 URL组成
* 2 不规范的URL
* 3 URL规范化过程
* 4 SEO URL规范化

URL组成:
protocol :// hostname[:port] / path / [;parameters][?query]#fragment
协议://主机名[:端口]/ 路径/[:参数] [?查询]#Fragment

不规范的URL:
1 URL中多余的字符
1.1 子域名的URL中包含"www": "http://www.shudo.blog.com/"
1.2 含有默认端口: "http://www.blog.com:80/shudo/"
1.3 松散的URL: "http://www.chapters.indigo.ca/books/amazon-sucks-donkey-balls/9780470170779-item.html"
1.4 多余默认文件名index.html,default.aspx等:"http://www.blog.com/shudo/index.html"
1.5 文件路径中
(1) 多余的"/":"http://www.blog.com/shudo//"
(2) 多余的点修饰串:"x/y/z/http://www.blog.com/a/b/http://www.blog.com/../page.html"
1.6 查询串中多余的
(1) ? (空查询串):http://www.blog.com/shudo?
(2) &
(3) 无用的查询变量:http://www.example.com/display?id=123&faint=faint
2 URL缺少字符串
2.1 缺少"/":"http://www.blog.com/shudo"
2.2 查询串缺少名称或者值:"http://www.example.com/display?id=" 或者 "http://www.example.com/display?=123"
3 其他不规范的URL
3.1 "http://shudo.blog.com/" 与 "http://www.blog.com/shudo/"其实是相同的内容
3.2 使用IP代替域名
3.3 含有扩充字符(extended characters),大小写敏感("http://www.google.cn/Intl/zh-CN/about.html" 和"http://www.google.cn/intl/zh-CN/about.html")
3.4 "+"和"%20"混用
3.5 查询变量顺序混乱:"http://www.example.com/test.aspx?bar=1&a=test"
3.6 含临时的状态变量:http://www.example.com/test?back=/prevpage.aspx

URL规范化过程:
1.URL协议名和主机名小写化
HTTP://WWW.EXAMPLE.com/test -> http://www.example.com/test
2.escape序列转化为大写,因为escape序列大小敏感
%3a ->%3A
3.删除Fragment(#)
http://www.example.com/test/index.html#seo -> http://www.example.com/test/index.html
4.删除空查询串的'?'
http://www.example.com/test? -> http://www.example.com/test
5.删除默认后缀
http://www.example.com/test/index.html -> http://www.example.com/test/
6.删除多余的点修复符
http://www.example.com/../a/b/../c/./d.html -> http://www.example.com/a/c/d.html
7.删除多余的"www"
http://www.test.example.com/ -> http://test.example.com/
8.对查询变量排序
http://www.example.com/test?id=123&fakefoo=fakebar → http://www.example.com/test?id=123 \
9.删除取默认值的变量
http://www.example.com/test?id=&sort=ascending → http://www.example.com/test
10.删除多余的查询串,如?,&
http://www.example.com/test? → http://www.example.com/test
11.Dust 规则(Schonfeld 等人提出的启发式方法)
http://www.example.com/test?id=123 -> http://www.example.com/test_123

SEO URL规范化:
不规范的URL会造成网站很多重复的URL,导致爬虫重复抓取同一内容,影响网站有效的内容被抓取,同时也就影响索引。
多个不规范URL造成PR稀疏,本来流向同一页面的PR,结果造成了流向多个不规范的URL。
还有一个用户体验问题,复杂或者不规范的URL容易使用户对网站造成不良印象。

Google管理员增加了URL规范化的工具,可以删除URL中无用的参数。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值