Browser address bar: http://mysite/literature

href links: href="literature/guidebooks"

I click on the link and its url is shown in the left below in chrome: http://mysite/literature/guidebooks

I add to the address bar the slash:

Address bar: http://mysite/literature/

href links: href="literature/guidebooks"

I click on the link and its url is shown in the left below in chrome: http://mysite/literature/literature/guidebooks

Why it happens? Why is one more literature/ added?

  • It is correct to use absolute paths, add / at the beginning of the link, for example /literature/ , then the link will be to http://mysite/literature/ absolutely from any path inside the site. - Artem Gorlachev

1 answer 1

  • http://mysite/literature download the literature file from the site root
  • http://mysite/literature/ download the index file from the literature folder , which is located in the root of the site
  • href="literature/guidebooks" download the guidebooks file that is in the literature folder in the current folder

Accordingly, in the first case - the current folder is the root of the site, and in the second - the literature folder

The fact that your server interprets the request to the file and to the index file in the folder as a single request does not concern the browser and does not interest