Forum Moderators: phranque

Message Too Old, No Replies

Relative vs From-The-Root Links

../../article/page.htm vs /section/article/page.htm.

         

snair

5:00 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



I've seen quite a few sites these days where their links all start from the root (e.g. /section/article/page.htm) as opposed to a more relative path (e.g. ../../article/page.htm or article/page.htm)

I'm wondering if this is simply done dynamically and/or if there is a specific reason why people are doing this (e.g. performance issues)?

2by4

6:10 pm on Apr 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's for long term site maintainance issues, I used to use relative, but then when I would do major site changes I'd always end up forgetting a bunch of them. When you use absolute links, the links always point to the same place, that's especially useful on js and css and site image files.

To develop a site with absolute paths you need to use a web server on your development box, otherwise the pages will look for the files starting from the partition root, like c:\, not the web site document root, which is a virtual thing.

snair

9:51 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



Ah... now I get it.

Thanks!

decaff

6:57 pm on Apr 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



and when you use absolute hrefs (yes it bloats the code some)...you can place any link anywhere on the site and human visitors and bots will always find the exact resource that it points to....you can't do this with relative...

you can develop using relative...just be shure to convert all hrefs to absolute before you go live ..

You can do this quickly with a global search and replace...if your development tool supports this..

snair

4:41 am on Apr 24, 2005 (gmt 0)

10+ Year Member



Thanks for the tips!

I really appreciate it :)