Links, what is the best way.....
Hi,
what is the best/correct way to put links on a site ?
Should I use links like /page,html or /path/to/page.html or the whole http://www.site.com/page.html?
What is the difference between these ? & does any style of link slow down page loading ?
Mika
Megan posted this at 18:12 — 6th January 2002.
She has: 11,421 posts
Joined: Jun 1999
Normally you should use a relative path. However, if you're using SSI it may be better to use the whole path in your includes depending on how your server's set up.
Megan
Connect with us on Facebook!
Brian Farkas posted this at 20:15 — 6th January 2002.
They have: 1,015 posts
Joined: Apr 1999
As Megan mentioned, it's better to use relative links instead of the entire URL. That way, if someone accesses your site in the form of http://domain.com/ they will not be brought to domain.com when they click a link.
Neither style, however, slows down page loading any more than the other.
mairving posted this at 02:02 — 7th January 2002.
They have: 2,256 posts
Joined: Feb 2001
The fastest way is always:
page.html but this only works if you don't use sub-directories.
/page.html is slower but not perceptibly so.
http://www.sitename.com/page.html is quite a bit slower than the above and should only be used in stuff like html emails.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
Brian Farkas posted this at 03:50 — 7th January 2002.
They have: 1,015 posts
Joined: Apr 1999
Really? Hmm.. didn't know that. Where did you hear that from? I wouldn't have thought that just a few extra characters of text would have significantly affected page loading at all. I guess you learn something new each day.
Brian
Busy posted this at 04:44 — 7th January 2002.
He has: 6,151 posts
Joined: May 2001
If you use the full path, say on images, the browser actually goes out of your directory/domain and comes back in for each full pathed object listed, but if you only have the image name it knows they are all within your directory.
yabber posted this at 15:54 — 7th January 2002.
They have: 93 posts
Joined: Dec 2001
The problem that I have at the moment is using SSI on all my pages to call 1 menu, and I am also using the same menu in sub-domains, so ../index.html from a sub-domain results in a page not found, as a result I have used http://www.domain.com/ as links for all the pages in my menu.
Is this a good/bad thing ?
Any other Ideas Suggestions ?
Thanks
Mika
Megan posted this at 16:11 — 7th January 2002.
She has: 11,421 posts
Joined: Jun 1999
You might have to use full URL's just in your includes to make sure everything references properly.
mairving posted this at 16:34 — 7th January 2002.
They have: 2,256 posts
Joined: Feb 2001
Leave the .. out of ../ so that it is /
Using ../ forces it up one level, using / forces it to read from your document root of the server which is where the index page is.
Brian, as far as where I heard about the difference between using sitename.com/pagename.html as opposed to /pagename.html . , who knows where I read that. It just comes from practice. Using the full path causes the server to first find sitename.com, then index.html. Using /index.html, causes it to only use the path from the server that it is on. Several other factors come into play. One is your cache. If the link is already loaded is in you cache, the speed difference will not be as great.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
yabber posted this at 16:41 — 7th January 2002.
They have: 93 posts
Joined: Dec 2001
but if I
in my menu doesn't make any difference as when the user has navigated to one of my sub-domains the /page.html reads from the document root of the sub-domain means that they get a page not found, unless I duplicate my site in each sub-domain.
SO for now I guess it has to be http://www.....
Mika
mairving posted this at 17:49 — 7th January 2002.
They have: 2,256 posts
Joined: Feb 2001
Oops, I really didn't see the part about sub-domains, which have their own docroot. You could specify the full path to the menu, like so /home/username/public_html/menu.html.
I personally don't use SSI. I prefer just to use includes in PHP.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
Anonymous posted this at 05:20 — 20th January 2002.
They have: 5,633 posts
Joined: Jan 1970
Cant you just use ".\file.php"
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.