Search code examples
htmlhref

How does <a href="/test/" load content?


At first I am not familar with HTML.

I have been trying to study different websites as I build my own.

I cannot figure out how content is being loaded when the HTML says

<a href="/test/">...</a>

instead of

<a href="test.html">...</a>

What is it loading? I think I understand that if I see

<a href="/test">...</a>

then I just can't see the file extension (altho I don't know why).

But when there is another backslash so it looks like a folder, what is that loading and how? I am using simple javascript (.hide and .show) to change out my content, and using the hash value to make it linkable, but would prefer to have an URL that looks clean like www.test.com/test/ instead of www.test.com/test.html#test

I am vaguely aware of mod_rewrite but not sure if that is what's going on when I'm looking at the href link in the HTML of a site...

Thanks very much, I'm sure it's an easy question but I can't figure it out!


Solution

  • First of all you should break down your question into multiple questions. Regarding "/test/" it's the same as "/test" and it means the relative url to servers public root folder, then test directory (or any aliases) then the default DirectoryIndex setting (usually index.html/php etc.). In fact, the "/test/" form is more desireable, as far as I remember (not sure abotu this last one)