AddressingBefore we go any further, it will be useful to take a minute to understand the difference between absolute and relative addressing. Let's begin with a typical URL (see an article title "URLs" for more information about URLs in general).
This is known as absolute addressing. You are specifically and totally representing exactly which URL you desire. This kind of addressing is most useful for referencing things which are outside of your web site. You will also use absolute addressing to reference files stored on FTP sites. However, this kind of addressing should not be used to references files and objects within your own web site. To do that you need to use relative addressing. Let's start simple.
If "page1.htm" needs to reference "page2.htm", it would look like this:
You see, we leave off the "http://www.html-helper.net/tutorial/" because the web server is smart enough to understand that if none of that is present then the file is in the current ("/tutorial/") directory. Let suppose you have the following two URLs.
Okay, now the file "myform.htm" needs to make a reference to the file page1.htm. How do you do that?
Huh? That sure looks strange, doesn't it? What this means is "go up one directory (that's the http://www.html-helper.net/) and then go to the "/tutorial/" directory and get the file "page1.htm". Let's do a little more complicated example.
If the file "tt.htm" needed to reference "privacy.htm" it would look like this:
If "privacy.htm" needed to reference "tt.htm" it would look like this:
You see? Okay, now comes the big question. Why not use absolute addressing all of the time? Well, let's say your site is hosted on Geocities.Com and you are using absolute addressing. Now you move it to Bizland.Com. Because you are using absolute addressing you must go through and change every single reference from Geocities to Bizland. This is very tedious (I know, I did it once before I found out about relative addressing). And that's all I've got to say about that. |