当前位置:网站首页>What are absolute and relative paths, and what are their advantages and disadvantages?

What are absolute and relative paths, and what are their advantages and disadvantages?

2022-06-11 00:22:00 Hua Weiyun

Absolute path refers to the complete URL containing the domain name . A relative path is a path that does not contain a domain name 、 The relative URL of the linked page relative to the current page .

150.png

Such as A、B Two pages URL:

http:// website /pageA.html
http:// website /pageB.html

page A Link to page B When using this code :

<a href="../pageB.html">

This is the relative path .

If you use the complete URL:

<a href="http:// website /pageB.html">

This is the absolute path .

One 、 Absolute path

advantage :

1、 Encounter lazy plagiarism 、 Collector , You can also increase the chain and weight of the website , Now collectors can edit the collected content , Forget this one .

2、RSS When the output , The content will be Feed Aggregate web crawler display , Links to the original site may be retained , However, this function is not applicable now .

3、 Help to prevent and solve the problem of website standardization .

shortcoming :

1、 Unless the link is dynamically inserted , Otherwise, it is not easy to test on the test server .

2、 Unless the link is dynamically inserted , Otherwise, it will be more difficult to move the page .

Two 、 Relative paths

advantage :

1、 Mobile content is easier , No need to update links on other pages .

2、 It's easier to test on the test server .

3、 Save code .

shortcoming :

1、 Page movement position , The links inside may need to be changed .

2、 Being copied and collected is not good for the website .

3、 Search engine analysis URL There may be errors in the process , The link on the page cannot be read correctly URL.

Whether it's an absolute path or a relative path , Website URL External display is absolute , The relative path is only for the station , And it is not easy to be recognized by search engines .

up to now , Some advantages of absolute path and relative path no longer exist .

Today's development of the Internet , The focus on the website has shifted , At the same time, the search engine is right SEO The algorithm has been gradually improved .

Users' expectations for audio media and video are redundant with text content , image RSS、Feed And share such features , Many websites have been abandoned .

author : Good advice

source :https://www.badpon.com/2603.html

原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206102244492148.html