0

I read somewhere that I can add a href="./" on any page in any sub-directory to send the user to the root index.html file, however this doesn't seem to be working. As the title suggests I am trying to not have /index.html in the URL when the user clicks a home link

5
  • So what's wrong with <a href="http://whatever.com/index.html">Home</a>? Commented Apr 15, 2013 at 17:13
  • in a subfolder, it won't work... Commented Apr 15, 2013 at 17:14
  • @Bartdude Am talking about absolute path :) Commented Apr 15, 2013 at 17:14
  • "this doesn't seem to be working" — If it doesn't do what you expect, what does it do? Commented Apr 15, 2013 at 17:14
  • Just use a "/" (no period). Commented Apr 15, 2013 at 17:14

2 Answers 2

2

Then just use :

<a href="/">home</a>

or

<a href="/index.html">home</a>
Sign up to request clarification or add additional context in comments.

3 Comments

Awesome, "/" works. Obviously... I don't want to use /index.html... because the URL will show that.
yep, I placed it there just in case :-)
also you can do things like <a href="/?var=1">send...</a> will send the var 1 to the index page on the server...
0

If you are in www.yoursite.com/dir/ and you want to go to your root folder you must use ../ instead of ./

If you want to go back from www.yoursite.com/dir/dir2/dir3/ to your root dir you have to write: ../../../ The best solution probably would be the full path to your root folder: www.yoursite.com/

1 Comment

and what if his site has multiple domain names ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.