Say you have a document located at
http://community.nbtsc.org/~user/specialstuff/quux
.
Then, in your HTML for that page, if you link to
grobnitz
, then the URL will end up being http://community.nbtsc.org/~user/specialstuff/grobnitz
. The browser sees no start of a complete URL nor a / to start things, it takes everything up to the last / in the URL of the document, and adds your link to that.
If you link to ../somewhereelse/foo
or to /~user/somewhereelse/foo
then the URL will end up being http://community.nbtsc.org/~user/somewhereelse/foo
. In this case, if the browser sees /~user/somewhereelse/foo
in the link, it chops the URL of the document off right after the host part — in this case, community.nbtsc.org
. It adds what you specify, and you get the result. If you put in ../somewhereelse/foo
, then it sees "no /" like before, but then, the ..
cancels out one part between slashes, in this case, the /specialstuff/
.
If you link to /gringo
, then the URL will end up being http://community.nbtsc.org/gringo
.
And, if you link to http://www.google.com
, the URL will be http://www.google.com
.