Saturday, December 20, 2008

The Breakdown of a URL

If you use the internet often, you should know what a URL (Uniform Resource Locator) is. However, what most people do not know is what URLs are comprised of and how they are generated. Prepare to be educated.

Lets take an example URL. http://www.example.com/home.aspx?var=101. What does each part of this URL mean?

Http://
This first part of the URL specifies what protocol to use when opening the connection. When browsing the internet, most times this value will be http. Http stands for Hypertext Transfer Protocol. This tells your browser to use a specific method to open the rest of the URL. Most likely, while browsing the internet, you will find 3 main protocols: FTP, HTTP, and HTTPS. Ftp is the file transfer protocol (for downloading files) and Https is a secure website.

www.
This part of the URL is called a subdomain. In most cases, when the subdomain is "www", it can be omitted and the desired web page will still be shown. However, other sub domains will not work in the same manner. For example, mail.example.com, www.example.com and example.com are three totally different places.

example.com
Example.com would be this URL's hostname, or more commonly known, domain name. Your computer takes the domain name, looks at a DNS (Domain Name Server), and retrieves the IP (internet protocol) address of the server/computer you are locating. This basically tells your computer which server/computer it should request the page/file from.

/home.aspx
home.aspx is a file located in the root level directory of the website. The .aspx section of the filename is the file's extension. The extension tells the Computer/Server how to handle the file. In this case, the .aspx would tell the server to use ASP.Net to compile the page before sending it to you. Here is a list of some extensions and their uses:

ExtensionDescription
.htmlNormally a static HTML page, sometimes is mapped to another language and creates the appearance of a static page.
.phpA dynamic page generated using PHP (Hypertext Preprocessor)
.plA dynamic page generated using PERL (Procedural Language), can also be used to denote a polish page (not common)
.aspA dynamic page generated using Microsoft's ASP (Active Server Pages)
.aspxA dynamic page generated using Microsofts ASP.Net (Active Server Pages .Net)
.cssA Cascading Style Sheets file
.shtmlAn HTML page with a server side include
.jsA Javascript file
.jspA dynamic page generated using JSP (Java Server Pages), also (incorrectly) used to name a Javascript file.
.rssA Really Simple Syndication file (RSS)
.xhtmlA static xHTML page
*Please note that any of these extensions can be mapped for different uses by the server administrator, but these are the most common uses.

?var=101
The ? part of this URL denotes the end of the filename and location and the beginning of a list of variables. In this case, we have one variable, named var, and it is set to have the value of "101". More variables can be listed here and can be changed manually (maybe even to your advantage) when browsing the internet. If a page is dynamic, the parser on the computer/server you are connecting to may use these variables to process the page you are requesting or collect information about you. In most cases, variables are entered by a user through a form (using the GET method). However, static links and HTTP redirects can lead you to a URL with these variables in them.

I hope now that you have a basic idea of what a URL is made of and have learned something from this post.

0 comments:

Post a Comment