Absolute and relative paths

Efficient Use of URLs

Before creating links to documents and images on the Internet, think about how you intend to link to them. There are two standard ways to create links:

  • absolute paths
  • relative paths

Absolute Path URL

An absolute path is called so because it refers to a specific location on the Internet, including the domain name.

An absolute path that points to a particular web element is often referred to as a URL. For example, the absolute path to this web page: https://a3s.biz/absolyutnye-i-otnositelnye-puti/

Absolute paths are commonly used with domains to point to web elements located on another site. For instance, if you need to link to the “internet” section of our site, you should include the domain name in the URL: https://a3s.biz/cat/web/. Therefore, the link would appear like this: <a href=”https://a3s.biz/cat/web/”>Internet</a>

If you need to reference a web element on the same domain where you are, do not use the site name in the link. Simply leave that domain, and do not forget to include the first slash (/) after its name. For example, the “design” section has the URL: https://a3s.biz/cat/path/. If you are linking to this URL from another page on the same site, the link would look like this: <a href=”/cat/design/”>Design</a>

It’s a good idea to use absolute paths without the domain name on most sites. This format ensures that links or images will be used regardless of where you place the page. It may seem silly to use longer links, but if you highlight fonts on pages and list directories on the site, using the absolute path will considerably expedite the service procedure.

Relative Path URL

There are a few rules to create links using relative paths:

  • links in the same directory as the page do not have file name information
  • subdirectories are listed without any slash on the file name
  • links to one directory are listed as … /file name

How to define relative path:

  1. Determine the location of the page you are editing. For example, this article is in the section /cat/path/ on our site.
  2. Determine the location of the page or image you want to link to. For example, the second page of the article in the “Web Development” section is here: /cat/path/page/2/
  3. Compare the locations and decide how to reference it. Based on these points, activate one directory (/cat/razrabotka-sajtov/), and then return to the root directory
  4. Create a link using the rules described above: <a href=”../page/2/”>…</a>