E
E
Evgeny Ivanov2018-02-27 07:12:15
HTML
Evgeny Ivanov, 2018-02-27 07:12:15

How to correctly set the path?

For example, an icon, although it can be the path to any file in the html document.
A huge number of people recommend setting the path like this

<link rel="icon" type="image/png" href="/images/icon.png" sizes="128x128">

This path points to the root folder (for example, www or domains), then the images folder, which contains icon.png.
My site is in the domains/1/2/ folder. An icon in a folder along the path domains/1/2/images/icon.png.
I set the path like this
<link rel="icon" type="image/png" href="images/icon.png" sizes="128x128">

Although it could
<link rel="icon" type="image/png" href="/1/2/images/icon.png" sizes="128x128">

This option is not suitable. If you change the site folder, you need to change the path as well. And there can be many files.
So what's the point of setting the path with a leading slash if it's not a universal solution?
How to correctly set the path?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-02-27
@Stalker_RED

A huge number of people recommend setting the path like this
...and they are right.
What is preventing you from setting up the site root normally? Do these /1/2carry some kind of payload, or do they just interfere?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question