Page 1 of 1

using full links or relative links

Posted: Mon Oct 20, 2003 8:59 pm
by mccommunity
we are building a website is there truth that it slows the process down if you use http://websitename.com/pages/link.php rather than pages/link.php . I am not sure what is best. Could someone help me with this one and let me know why? Thanks.


Mark

Posted: Mon Oct 20, 2003 9:18 pm
by nigma
Well, by using

Code: Select all

<a href="http://websitename.com/pages/test.html">
Would make the HTML file larger in size which could slow down the page load time.

Posted: Mon Oct 20, 2003 9:26 pm
by d3ad1ysp0rk
not sure how browsers work, but im assuming after it connects to the main server, loading directorys under it would take less time.

I've always used relative, cept for things, like includes, that go on every page (in different directorys), because you'd need absolute for them. and of course, other people's sites.

Posted: Mon Oct 20, 2003 11:48 pm
by rprins
If you ever need to change URLs (http://www.xxx.com becomes http://www.yyy.com), your static links will all break. Personally, I use dynamic linking (./page.html or ../mydir/mypage.php). This way, I can just move my directory tree around and there are no problems if I change the URL name. The only time I use static links are when I have subdomains and I need to get to a different part of a site (admin.site.com to site.com).

Hope that helps.

Posted: Tue Oct 21, 2003 5:04 am
by cybaf
The main reason for using relative links (as I've learned anyways) is to hide the document root. Depending on how your webserver is setup this is important. Because in many cases the relative link dir/link.php points to a different place compared to http://somesite.com/dir/link.php...

Posted: Tue Oct 21, 2003 7:46 pm
by Unipus
There aren't many good reasons to use absolute paths that I'm aware of.

"/" is always your document root, everything else can be defined in your server settings... that should handle 95% of it.