How to link files in different folders?

Asked

Viewed 3,724 times

2

I’m having difficulty making a link between two HTML pages, the hierarchy of the folder is this:

hierarquia de pastas

I want to link the file:

J: Totem_app XPLACES acess cid_vitoria 1_acru.html

that has a button in your code for the file "00_menu_vitoria_xingu.html" contained in what would be the site’s root directory.

<a href="/../../00_menu_vitoria_xingu.html" target="_parent" 
class="bcontraste">LINK</a>

Turns out this way I’m having a "page not found" I’m going back two directories right? Using:

/../../ 

? For back 2 directories the 'cid_vitoria' and then the 'acess', then what is the functional way to link the files?

  • 1

    Try href=". /.. /.. /00_menu_vitoria_xingu.html" or href="~/00_menu_vitoria_xingu.html" sometimes resolve...

  • ok I’ll test! Thank you.

  • @hugocsl worked. Thanks! But can you explain the logic of why /.. /.. / didn’t work? . / means it should stop in the root folder is this?

  • 1

    dib posted more explanations in the answer to your question below. If it helped you consider mark it as accepted :)

1 answer

1


Try it this way href="./../../00_menu_vitoria_xingu.html" that should work. The file is in the third folder up, therefore the ./ extra on the path that points to the location itself.


Here is an explanation. about the path of the archives.

See this short excerpt of an answer in another question

  1. If the path begins with ../ or ./ then they will be removed from the prefix:

    ../a/b/ca/b/c

  2. If the path begins with /./, /../ they will be exchanged for /

    /./a/b/c/a/b/c

  3. Break up with /., /./, /.. will remove the /. and /..:

    /a/b/c/../a/b/c/ and /a/b/c/./a/b/c/

  4. Break up with /./ and /../ will remove an item:

    /a/b/c/..//a/b/

  5. If /../ is in the middle will remove the prefix (similar to explanation 4):

    /a/b/../c//a/c/

  6. If ./ be in the middle will have the same behavior as explanation 2:

    /a/b/./c//a/b/c/

Some extra details on Path to access html folders ,css,php etc

Of course the reading of RFC 3986 is something a little difficult, even for those who already have some experience, some of the examples made with tests, to summarize the .. would be to move up a folder level (if not in the prefix) and the ./ would be to point out the site itself.

Credit to: Guilherme Nascimento /users/3635/guilherme-nascimento

OBS: The option with the ~ Searches the file straight from the root folder, in your case the J, I tried to find a reference of pq did not work, but unfortunately I did not find. Then disregard this rss option

Browser other questions tagged

You are not signed in. Login or sign up in order to post.