Home > database >  Link HTML file outside its folder
Link HTML file outside its folder

Time:07-19

I have a folder named "myWebsite". Inside that folder I have "index.html" and another folder named "other". Inside "other" I have CSS files JS files and "page2.html". I have linked all files with my "index.html". But when I am in "page2.html", I want a link that will lead me to "index.html".

<a href=".../index.html">go back</a>

CodePudding user response:

In order to navigate back you should use '../' if you want point two folders back you can use '../../' for instance.

In this case, within Page2.html use:

<a href="../index.html">go back<a>

NOTE: You have an extra dot.

CodePudding user response:

Based on what you wrote, this should fix it:

<a href="../index.html">link</a>

The ../ directory references the parent directory. See here for more on HTML filepaths.

  • Related