There are several links:

  1. <a href="/path/">Link1</a>
  2. <a href="/path">Link2</a>
  3. <a href="./path/">Link3</a>
  4. <a href="./path">Link4</a>

What is the difference? I tested, but did not understand anything.

PS I know that on the server there is such a thing as a root directory, it is accessed via / as from the main directory and it also applies to the separation of directories. There is also ../ used to go up the hierarchy.

1 answer 1

There are always 2 catalogs in the catalog:. and .. Two points are lower, and one is the current one. That is, the difference between the links is only if you write a slash at the end and, as you have already noticed, it means lifting one directory by hierarchy.

  • ../ - на каталог выше , ./ - текущий каталог . But I did not understand the difference with the slashes at the end! What is the difference between path/ and path ? - MaximPro
  • @MaximPro The difference of path / and path depends on the site. Someone has no difference, someone will write an error. If path represents a directory on a site, it is often automatically added /. In fact, some other index.html is automatically substituted in both cases - Sergey
  • @Sergey i.e. does it specifically depend on server setup? - MaximPro
  • @MaximPro Well, yes. There was a time that I personally smoked manuals so that my server would understand path as path/ . I also do not want to write an extra sign, especially since for his set two hands are required (or at least two fingers :). True it is only on the Russian layout. - Sergey
  • @Sergey I have a xampp vanilla build and path/ and path are understood the same way =) I asked for this reason for this reason, and besides, most sites interpret it the same way. - MaximPro