Forum Moderators: phranque

Message Too Old, No Replies

Relative vs. Virtual Linking

         

Filipe

5:22 am on Sep 5, 2002 (gmt 0)

10+ Year Member



I'm not sure if I'm using the word "Virtual" properly, but here are the different things I'm considering doing with documents on my site:

1. Virtual interlinking
<img src="/images/filename.gif">
<a href="/index.htm">
<? include("/application.php"); ?>

2. Relative interlinking
<img src="images/filename.gif">
<a href="../../index.htm">
<? include("application.php"); ?>

Virtual linking (correct my terminology if that's wrong) is all based on the root URL, and the latter is all based on the current file's directory. I remember hearing that using the former is bad practice, but I can't remember why.

I would rather use the former, because it would help me make scripts more uniform.

bobriggs

5:46 am on Sep 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Virtual...I think I call it absolute; I don't think the terminology is that important.

Actually I prefer to prefix the URLs with the absolute path: [example.com...] on my pages.

The good thing about relative URLs is that it does save space and bandwidth. However, I've noticed lately that these relative URLs on a google cache will now try to fetch a page on Google itself! Or it could be a javascript popup - it tries to fetch a page on google.

I don't think the former is bad practice, and in fact I think it's better to put the entire absolute URL in there (http: included). That way there's no way for any browser or UA to get confused.

BlobFisk

11:12 am on Sep 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another factor in determining whether to use root relative, absolute or folder relative pathing is the Server system that you are using.

IIS will allow you to use relative or absolute (../... or www.xxx.com/../), but some (like AIX) insisit on root specific pathing (/root/dir/dir/file).

Duckula

6:12 pm on Sep 5, 2002 (gmt 0)

10+ Year Member



Virtual linking is (was? subjective thinking) bad practice in the case of moving whole directories around; with the relative linking is possible, for example, moving a whole directory from your local machine to the server without worries; that is not always important, but a good practice anyway.