Uniform Resource Locator

Put simply the URL, or Uniform Resource Locator, is the address of a web page. For example, the URL of this web page is:

http://www.asch.org.uk/teaching/webdesign/techie/url.html

Like a physical postal address, this identifies the location of the web page (or other resource). Like a postal address, it can be divided into different parts, and understanding what those parts contribute to the whole address can help you understand something about the type and possible geographical location of the page you are about to visit.

The Structure of a URL

A URL is composed of a number of distinct parts. Although most page addresses do not contain all of the parts, they are defined as:

scheme://domain:port/path?query#fragmentid

An example will help before we delve into details. Consider the address of this page again:

scheme :// domain : port / path
http :// www.asch.org.uk     / webdesign/techie/url.html

Notice that the port part of the address is missing. It usually is left out, as the browser can usually guess the port from the scheme (for http, it's usually 80). Also, the query and fragmentid parts have also been left out as these are not used for this address.

scheme

The scheme is the portion of the address that identifies the protocol that should be used to access the resource. For web pages this portion of the URL is http, indicating that the browser should use the standard web protocol to obtain the page. Other protocol schemes that you may encounter include https and ftp.

domain

The domain specifies the actual location of the server that will deliver the requested resource. On the web, most domain names start with the prefix www. - for example, the domain of this site is www.asch.org.uk - but this is not necessary. The domain for one particular web design site is simply http://sixrevisions.com/ with no www. prefix. A more detailed description of the domain is given below. The domain is not case sensitive.

port

Every computer that accepts connections, listens for those connections on a port. Think of this as a numbered socket that someone can connect to. The port element in a URL is optional. If it is left out, then the browser will use the default port for the given protocol. For example, if the protocol scheme is given as http, then the browser will connect to port 80 on the server; if the protocol is https, then the browser will connect to port 443 on the server. Sometimes a web server may be set up to expect requests on a different port number and, in that case, the port number would have to be included - for example, http://www.asch.org.uk:8080 would issue the request to the server at www.asch.org.uk on the port 8080.

path

The path portion of a URL specifies where in the web site hosted on the given domain the particular page is to be found. This is simply the file path through your sites folder structure, to the actual page. When you are designing the file structure of your web site you should give some thought to the particular paths that will result. If there are some paths that you might expect your users to enter directly, these should be kept as simple as possible.

Note that the path is case sensitive. However, some web servers, particularly those hosted on Microsoft servers, behave as if it is not.

query

This portion of the URL is used to pass information to the server. For example, if you are browsing the Amazon web site, it uses a query string to keep track of what you are looking at. The query can consist of multiple bits of information.

fragmentid

The fragmentid refers to a specific location within the page itself. If you have included named anchors in your page, then the fragmentid can refer to one of these. For example, the heading of this subsection has the named anchor "fragment" associated with it. that means that the URL

http://www.asch.org.uk/teaching/webdesign/techie/url.html#fragment

links directly to this section in the page. Try pasting the URL shown above into a new browser window to see where it takes you!

Understanding the Domain Name

The domain itself has a number of parts that are worth breaking down even further. Perhaps it is best to do this by reading the domain from right to left. Again, lets take this domain as an example:

www.asch.org.uk

Starting on the right we have the part .uk - this is the top level domain (TLD) for this site. In this case it is the country code corresponding to the UK. Every nation has a corresponding TLD, but not all TLDs are national codes. For example, the domain name of the computer company IBM is www.ibm.com, in this case the TLD is .com - this is one of a number of international TLDs.

The next part of this domain is .org - this is the second level domain of this site. Simply put, the second level domain is just the portion of the domain immediately below the top level domain. The .uk TLD has a large number of SLDs which are supposed to indicate the nature of the organization running the web site. For example .co would be commercial domains, .org are general organizations, .ac are academic institutions, .gov are government sites, and so on.

The Nominet page listing the UK SLDs that individuals can apply for can be found here:

http://www.nominet.org.uk/registrants/aboutdomainnames/sld

Wikipedia has an article about the .uk TLD, including all its SLDs here:

http://en.wikipedia.org/wiki/.uk

The final part of the domain in this case is www.asch - in this case asch is the main domain name, and www. specifies that it is a World Wide Web site. As noted above, the www portion is dropped by some websites.

The final component that some websites use in their domain name is sometimes called a subdomain. Technically, the whole domain name is a hierarchy of subdomains: .org is a subdomain of .uk and .asch is a subdomain of .org.uk. However, in this case we are referring to the case where a subdomain is introduced below the principle domain. A good example of this is Wikipedia. The main domain in that case is wikipedia.org and subdomains are used to indicate separate versions in different languages. Thus, en.wikipedia.org is the English language version and nl.wikipedia.org is the Dutch version.

Note that the www is also technically a subdomain. Thus, for example, www.asch.org.uk would be the address of the web server for asch.org.uk and mail.asch.org.uk would be the address of the mail server for asch.org.uk.

Absolute and Relative URLs

So far, all the URLs that we have seen are absolute. That is, they provide the complete information necessary to access the specified resource. However, it is also possible to have a relative URL. In that case, the address is specified relative to the current location using the standard conventions for describing a relative path.

For example, we have already seen that the absolute address of this page is:

http://www.asch.org.uk/teaching/webdesign/techie/url.html

This contains all of the information needed to find this page. Now, if I wanted to specify the address of the images page in the same folder as this page, I could simply write

images.html

This corresponds to the absolute address

http://www.asch.org.uk/teaching/webdesign/techie/images.html

Alternatively, if I wanted to refer to the index page for this web design site, relative to this current page, I would write

../index.html

which you would read as going one level up in the folder hierarchy and then selecting the file index.html. This relative URL would only work from the current page and it corresponds to the following absolute address:

http://www.asch.org.uk/teaching/webdesign/index.html

As a final example, if I wanted to refer the page about the Dreamweaver interface in the dreamweaver folder using a relative URL I would write

../dreamweaver/interface.html

which you would read as going up one folder level, then going into the dreamweaver folder and selecting the page interface.html. This would correspond to the following absolute address:

http://www.asch.org.uk/teaching/webdesign/dreamweaver/interface.html

When you are creating links in Dreamweaver from one page to another within your site the links that it makes are relative. However, Dreamweaver gives you the option of have those links created as relative to the current document, as shown above, or relative to the site root.

Don't forget that if you move or rename a file that has links to it from other pages in your site, then all of the link URLs will need to be updated. If you make these updates using the File tab in Dreamweaver, then those updates can be performed automatically.

Links

Wikipedia has a comprehensive article about URLs, including links to related topics:

It also has a very comprehensive article on how the domain name system works: