当前位置:网站首页>什么是绝对和相对路径,有哪些优缺点?
什么是绝对和相对路径,有哪些优缺点?
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
边栏推荐
- Quick sort
- Deepin20菜单启动选项后自检到iwlwifi停机
- CSDN daily practice - find the closest element and output the subscript
- 【漫天烟花】绚烂烟花点亮夜空也太美了叭、某程序员携带烟花秀给大家拜年啦~
- LabVIEW打开其他EXE程序
- vtk.js中vtp下载
- 【二叉树】二叉树剪枝
- [pyGame games] tank battle, how many childhood games do you remember?
- Easyrecovery15 simple and convenient data recovery tool
- Opencv实战之图像的基本操作:这效果出来惊艳了众人(附代码解析)
猜你喜欢

LabVIEW displays the time and date on the waveform chart or waveform chart

LabVIEW用VISA Read函数来读取USB中断数据
![[pyGame games] don't look for it. Here comes the leisure game topic - bubble dragon widget - recommendation for leisure game research and development](/img/fb/a966b4bf52cdab4030578d4595e09b.png)
[pyGame games] don't look for it. Here comes the leisure game topic - bubble dragon widget - recommendation for leisure game research and development
![[appearance detection artifact] come on, please show me your unique skill (is this appearance worthy of the audience?)](/img/c4/b571bec5fe0cd2968e078a8231d0bd.png)
[appearance detection artifact] come on, please show me your unique skill (is this appearance worthy of the audience?)

LabVIEW锁相环(PLL)

csdn每日一练——有序表的折半查找

【Pygame小游戏】这款“打地鼠”小游戏要火了(来来来)

LabVIEW改变Point ROI Overlay的形状或颜色

【无标题】

【漫天烟花】绚烂烟花点亮夜空也太美了叭、某程序员携带烟花秀给大家拜年啦~
随机推荐
SystemVerilog (x) - user defined type
Collection delete element technique removeif
The same customized right-click menu beautification on this site - Xingze V Club
【Pygame小游戏】Chrome上的小恐龙竟可以用代码玩儿了?它看起来很好玩儿的样子~
LabVIEW phase locked loop (PLL)
How to handle the database query error with Emoji expression in Typecho- Xingze V Club
都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
【Pygame小游戏】这款经典的炸弹人超能游戏上线,你爱了嘛?(附源码)
[pyGame collection] please check the game guide through childhood: are there any games you have played? (attach five source codes for self access)
Excel essential toolbox 17.0 Free Edition
[opencv practice] this seal "artifact" is awesome, saving time and improving efficiency. It is powerful ~ (complete source code attached)
【LaTex】latex VS Code snippets(代码片段)
Method of converting file to multipartfile
LabVIEW中创建毫秒时间标识
The serial port in the visa test panel under LabVIEW or max does not work
[pyGame games] story stream recommendation: what kind of games can you like? (devil lover, bully's wife version)
Usage of C tryparse
30 | how to reset the consumer group displacement?
Is it safe for changtou school to open an account? Is it reliable?
Redis installation and common problem solving based on centeros7 (explanation with pictures)