Let’s say you’re accessing the site www.meudominio.com/dirA/dirB
if there is a link to this page /
will make you go back to the www.meudominio.com/
which is the root directory, the same applies when including imagens
, scripts
if you in a subfolder put /meuscript.js
it will look at the root or be www.meudominio.com/meuscript.js
Another example:
You have a page index.html
inside www.meudominio.com/dirA/dirB
on it you want to include a javascript called script.js
which is also in the same directory:
With absolute path inclusion would thus be
<script src='/dirA/dirB/script.js'></script>
With relative path inclusion would thus be
<script src='./script.js'></script>
Another answer which may also be useful
Possible duplicate of How to leave the relative folder path
– Icaro Martins
Possible duplicate of Difference between absolute and relative Urls in page contents
– José