Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between the absolute path and the relative path of files in the computer?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the difference between the absolute path and the relative path of files in the computer. What is introduced in this article is very detailed and has a certain reference value. Interested friends must read it!

The path to a file is used to describe the directory location of the file on disk, or the location in the website folder structure. The path is divided into absolute path and relative path; absolute path refers to the absolute location under the directory, which directly reaches the target location, usually the path starting from the root directory; relative path refers to the path relationship with other files (folders) caused by the path where the file is located.

The path to a file is used to describe the directory location of the file on disk, or the location in the website folder structure.

Paths are divided into absolute paths and relative paths.

The absolute path refers to the absolute location under the directory, which goes directly to the target location, usually starting from the drive letter (root directory).

The path that fully describes the location of the file is the absolute path, the directory path based on the root directory of the web site. The assignment of an absolute pathname is the path from the root at the top of the tree structure to a directory or file, consisting of a series of consecutive directories separated by a slash to the directory or file to be specified. the last name in the path is the directory or file to point to. The reason why it is called absolute means that when all web pages reference the same file, the path is the same.

/ / absolute path to the full URL of an Internet file

flower

The relative path refers to the path relationship with other files (or folders) caused by the path where this file is located. The use of relative paths can bring us a lot of convenience. The HTML absolute path (absolute path) refers to the full path of the file with the domain name.

/ / the file path points to a file located in the images folder in the root of the current website:

flower

Comparison between absolute path and relative path

Advantages of absolute paths in network applications:

1. To prevent the website from being maliciously plagiarized, use an absolute path. If someone plagiarizes and collects your content, the link inside will also point to your website. Some plagiarism is relatively lazy, even the links inside copied the past.

2, if the webmaster can not do 301 redirection, so there is a problem of URL standardization, using an absolute path helps to link to the selected version of URL.

3. Even if the page is moved, the link in it still points to the correct URL.

Disadvantages of absolute paths:

1. Unless the link is inserted dynamically, there is no way to test on the test server. Because the link inside will point directly to the real domain name URL, rather than the URL in the test server.

2. Unless the link is inserted dynamically, it will be difficult to move the content page. Because the location of the content page changes, the links on other pages may not change and point to the original hard-coded absolute path.

The above is all the contents of this article entitled "what is the difference between the absolute path and the relative path of files in the computer". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report