当前位置:网站首页>什么是绝对和相对路径,有哪些优缺点?
什么是绝对和相对路径,有哪些优缺点?
2022-06-10 22:45:00 【华为云】
绝对路径指的是包含域名的完整网址。相对路径指的是不包含域名的、被链接页面相对于当前页面的相对网址。

如A、B两个页面URL:
http://网址/pageA.html
http://网址/pageB.html
页面A链接到页面B时使用这种代码:
<a href="../pageB.html">
这就是相对路径。
如果使用完整的URL:
<a href="http://网址/pageB.html">
这就是绝对路径。
一、绝对路径
优点:
1、遇见比较懒的抄袭、采集者,还可以增加网站外链及权重,话说现在采集者都会编辑采集内容,这条就别想了。
2、RSS输出时,内容会被一些Feed聚合网站抓取显示,页面指向原网站的链接可能会被保留,不过这个功能现在不适用了。
3、有助于预防和解决网址规范化问题。
缺点:
1、除非链接是动态插入的,不然不好在测试服务器上进行测试。
2、除非链接是动态插入的,不然移动页面将比较困难。
二、相对路径
优点:
1、移动内容比较容易,不用更新其他页面上的链接。
2、在测试服务器上进行测试比较容易。
3、节省代码。
缺点:
1、页面移动位置,里面的链接可能需要改动。
2、被抄袭和采集对网站没有任何益处。
3、搜索引擎解析URL时可能会出错,不能正确读取页面上的链接URL。
不管是绝对路径还是相对路径,网站的URL对外显示还是是绝对的,相对路径只是对站内的,并且还不容易被搜索引擎识别。
到目前为止,绝对路径和相对路径某些优势已经不存在了。
互联网发展的今天,对于网站的关注度已经转移了,同时搜索引擎对了SEO算法也已经逐步完善。
用户对于音频媒体视频的期待多余文字内容,像RSS、Feed及分享这样的功能,很多网站已经弃用。
作者:良家佐言
来源:https://www.badpon.com/2603.html
边栏推荐
- LabVIEW使用MathScript Node或MATLAB脚本时出现错误1046
- Typecho blog site wide deployment of Tencent cloud CDN tutorial - Xingze V Club
- 【数学】【连续介质力学】流体力学中的对称张量、应变张量和应力张量
- [new version] new pseudo personal homepage v2.0- starze V Club
- LabVIEW determines the position of the control in the display coordinate system
- 都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
- MySQL命令行导入导出数据
- Lambda 学习记录
- Why many new websites are not included by search engines
- 【二叉树】二叉树剪枝
猜你喜欢
![[turtle confessions collection]](/img/97/6f1008386931bcb93655d94121e2c4.png)
[turtle confessions collection] "the moon at the bottom of the sea is the moon in the sky, and the person in front of us is the sweetheart." Be happy for the rest of your life, and be safe for ever ~

Self made app connected to onenet --- realize data monitoring and distribution control (mqtt)

【Pygame小游戏】首月破亿下载 一款高度融合了「超休闲游戏特性」的佳作~

vtk.js中vtp下载

LabVIEW 禁止其他可多核心处理的应用程序在所有核心上执行

【Pygame小游戏】激荡大脑思维,一起来玩转奇思妙想“24点”叭~(超赞滴)

How to measure the refresh rate of oscilloscope

LabVIEW或MAX下的VISA测试面板中串口无法工作
![[pyGame] this classic bomber super game is online. Do you love it? (source code attached)](/img/e5/a05c9b042f647b958bfacfe591459f.png)
[pyGame] this classic bomber super game is online. Do you love it? (source code attached)

LabVIEW pictures look bright or dark after being cast from 16 bits to 8 bits
随机推荐
[pyGame] can the little dinosaur on chrome be played with code? It looks like fun~
LabVIEW 禁止其他可多核心处理的应用程序在所有核心上执行
快速排序
2022年高考量化卷|请各位量化考生答题
LabVIEW使用MathScript Node或MATLAB脚本时出现错误1046
vtk. VTP download in JS
Pseudo static setting of Typecho - starze V Club
About optimizing API interface response speed
Hyperleger fabric installation
LabVIEW中NI MAX中缺少串口
基于CenterOS7安装Redis及常见问题解决(带图讲解)
LabVIEW用高速数据流盘
【Pygame小游戏】Chrome上的小恐龙竟可以用代码玩儿了?它看起来很好玩儿的样子~
[opencv practice] in cold winter, there will be a rainbow. Do you love this special effect?
Ilruntime hotfix framework installation and breakpoint debugging
【Pygame小游戏】激荡大脑思维,一起来玩转奇思妙想“24点”叭~(超赞滴)
Kubernetes 基本介绍及核心组件
MySQL命令行导入导出数据
【Opencv实战】寒冷的冬季,也会迎来漫天彩虹,这特效你爱了嘛?
Create millisecond time id in LabVIEW