|
All About URLs
URLs (uniform resource locator) are used to locate websites and webpages inside those sites. Each website has a unique URL. For example, Google's is http://www.google.com. Each part of a URL has a special meaning. I'll break down Google's URL as an example.
| http:// |
This part defines the protocol. By definition, all websites have this protocol or https:// (secure hyper-text transfer protocol). Other protocols include FTP (file transfer protocol), file (used to refer to files on the client's computer, not used on websites) and many other more obscure ones. |
| www. |
This part stands for World Wide Web. Usually it doesn't matter whether you put this part before a website, but a few website will not load if you don't put this before the next part. |
| google |
This part is called the host name. All this does is identify a website. No two website can have the dame host (domain) name. |
| .com |
This part is called the TLD (top-level domain) or web extension. This, to a certain extent, identifies the type of content the website will have. Other TLDs include .net, .edu, .biz, .gov, .mil, .au, .nl, .de. (Click here for a list of all TLDs) |
When a URL is being used to reference a disinct file on a server, it takes on the form of the above plus the where the file is stored. Here's a few examples
| http://www.website.net/page.html |
This URL is referring to a file called "page.html" on a server called "website" |
| http://www.website.net/images/picture.gif |
This URL is referring to a file called "picture.gif" in a folder called "images" on a server called "website," |
This kind of URL linking directly to a file and has all of the above elements is called an absolute URL. These are usually used to link to a file on one server from a different server. For example, the following link is absolute.
http://www.wintallo.com/wisesayings.html
When a URL links to a folder without specifying an exact page, your browser automatically takes you to a default page in that folder. Usually, your browser tries index.html, index.htm, index.php, etc. For example,
| http://www.google.com |
= |
http://www.google.com/index.html |
| http://www.google.com/contact |
= |
http://www.google.com/contact/index.html |
| http://www.eclipse.org/downloads |
= |
http://www.eclipse.org/downloads/index.php |
| http://www.safer-networking.org/en |
= |
http://www.safer-networking.org/en/index.html |
| http://www.nfpa.org |
= |
http://www.nfpa.org/index.asp |
| http://www.java.com/en/download |
= |
http://www.java.com/en/download/index.jsp |
When speaking of URLs, the opposite of absolute is relative. A relative link is used to refer from files on a server to other files on that same server. The following link represent relative link coming from http://www.coolwebsite.com/folder/webpage.html
| otherpage.html |
http://www.coolwebsite.com/folder/otherpage.html |
| images |
http://www.coolwebsite.com/folder/images/index.html |
| images/another.html |
http://www.coolwebsite.com/folder/images/another.html |
| / |
http://www.coolwebsite.com/index.html |
| //www.otherwebsite.com/ |
http://www.otherwebsite.com/index.html |
| /assets |
http://www.coolwebsite.com/assets/index.html |
| ../ |
http://www.coolwebsite.com/index.html |
| ../assets |
http://www.coolwebsite.com/assets/index.html |
| ../../../ |
http://www.coolwebsite.com/index.html |
| ../../../../../../../ |
http://www.coolwebsite.com/index.html |
| ./ |
http://www.coolwebsite.com/folder/index.html |
| ./otherpage.html |
http://www.coolwebsite.com/folder/otherpage.html |
This concludes my article on URLs. Thanks for reading and I hope this was informative
Sources:
http://www.webreference.com/html/tutorial2/4.html
For table of relative links.
|