[thelist] dot_slash vs slash for relative reference..

matt g mrg at members.evolt.org
Wed Jul 24 07:04:01 CDT 2002


> From: ".jeff" <jeff at members.evolt.org>

> there is a benefit to root relative, or leading slash, paths.  if you change
> your sites document structure, but images, scripts, and stylesheets are all
> still in the same folders you won't have to go change the paths to get them
> all working again as root relative paths are not in anyway relative to the
> calling document's location from the root of the site.

Bonus feature:
It also makes life easier if you are using included files from a different
level of the directory. In this case...

www.domain.com/index_which_includes_nav.html
www.domain.com/pages/file_which_includes_nav.html
www.domain.com/includes/nav.html

...you would want/need to use root relative hrefs and srcs in the "nav"
file, so that they will work, no matter where in the directory they are
being called from...

<!-- includes/nav.html -->
<a href="/index_which_includes_nav.html">Home</a>
<a href="/pages/file_which_includes_nav.html">File</a>

matt g




More information about the thelist mailing list