Forum Moderators: phranque
i'm here have a question, I found that when we create our link as above (start with slash), it has two meaning,
1.) Start from root directory of the webs-site
2.) Start from a Virtual Directory call /dir
If the situation is 2, then it might point to wrong location.
Please advice.
I would say what you ahve there is a relative URL... it's going to try to go to the directory/file from its present location.
www.mydomain.com/files/123.html = absolute URL
/files/123.html = relative URL
You can get away from the problem of relative URLs by putting a 'base href' the head section of your page:
<base href="http://www.mydomain.com.com/">
That way any relative URLs will be read as starting from the 'base href'.
I've found that if your site has a deep directory structure or if you use includes, option 3 works the best. If you have, say, an include for your header, and that header has image links, root relative pathing will ensure that these image links (/images/headerimg.gif for example) will still work no matter if the file calling the header include is in the root or nested 5 or 6 directories deep.
Hope this helps!
Andreas