0

I got an error while trying to go back to a root folder (folder A) from child folder (folder B inside folder A)..

I am confused, because I am trying every way to solve the problem but still got an error, "File not found..."

This is my code:

<a href="../folder B/folder A/index.html> Home </a> 
2
  • 2
    Please attach a image of files hierarchy. Also small issue in your provided code is that you haven't closed href with double quote. Commented Aug 16, 2024 at 11:10
  • If you are viewing a page that lives in folder B then the path ../folder B/folder A/index.html means "go up one folder (the ..) then go down one folder into 'folder B' then go down one more folder into 'folder A' — which is clearly not the folder structure you describe. Commented Aug 16, 2024 at 16:44

1 Answer 1

1
[ Folder A ] ---- index.html ---- [ Folder B ] -------- page.html 

Assuming the above is your folder structure (as described) and you are going from page.html in Folder B to index.html in Folder A, then you don't need to explicitly specify the folder name again. The following should be sufficient

<!-- Link to Index File in Folder A(index.html) from page.html--> <a href="../index.html"> Home </a> 

The ../index.html meant, leave current directory (Folder B) and go to the upper directory (Folder A) inside of which you would find index.html.

Note: A piece of advice is to use lowercase one word (or with underscore or hyphens instead of space) for your folder names in order to avoid issues with deploying on windows and linux system (e.g. foldera, folder-a, folder_a)

Sign up to request clarification or add additional context in comments.

1 Comment

Also note that including the index.html part is almost always superfluous — we servers will generally serve the file "index.html" if no filename (only a path) is given, so /foo/bar/index.html is the same as /foo/bar/ and ../index.html is the same as ../

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.