docs.roxen.comView this page in a printer friendly mode
DocsRoxenWebServer 3.3Web Developer ManualBasic Concepts
Copyright © 2004, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com

   

URL
HTTP
XML

URL

Absolute URLs

One of the most important concepts of the WWW is the URL standard, Uniform Resource Location. A URL is used as a pointer to a resource, usually a web page, on the Internet. A typical URL may look like this:


http://www.roxen.com/index.xml

This URL can be splitted up into three different parts. Everything before "://" is the protocol, in this example "http", which is the hyper text transfer protocol normally used on the WWW. Between the "://" and the first "/" is the host and the rest is the path. What is then the actual information contained in the line above? It simply means retrieve the document "/index.xml" from the host "www.roxen.com" with the HTTP protocol. Other common protocols are "https", which is secure HTTP utilizing the security layer SSL or TLS, and "ftp", which is an older way of transporting files.

The host part of the URL may optionally include a port description. If you consider the host domain as an address to the host, you can consider the port number the aparment number. The port number is implied by the selected protocol, e.g. 80 for http and 443 for https, but sometimes you want to reach a site that is not on the default port. This is done by appending ":" and the port number to the host part of the URL. The following URL points to the same resource as the above one.


http://www.roxen.com:80/index.xml

These type of URLs, containing protocol, host and path, are referred to as absolute URLs.

Relative URLs

Another often used type of URLs are the relative URLs. They refer to another document from within a document, e.g:


search.xml

The URL above means "the file called search.xml in the same directory as the document refering to it". If a link to "search.xml" was found in "http://www.roxen.com/index.xml" it means "http://www.roxen.com/search.xml". But if the same URL was found as a link in "http://www.roxen.com/platform/index.xml" it would mean "http://www.roxen.com/platform/search.xml".

A relative URL may also point to directories above or below its position. If we want to link to search.xml in a subdirectory games it would be "games/search.xml". If we on the other hand want to link to search.xml in the directory above we would use the ".." to denotate up, e.g. "../search.xml". It is possible to combine several ".." tokens, or combine them with directory names to walk down another path branch, e.g. "../../platform/search.xml".

Absolute path URL

Somewhere between absolute and relative URLs we'll find the absolute path URLs. They are not relative with respect to where on the server the URL was found, but it is relative with respect to on which server it was found.


/index.xml

The above URL means "the file index.xml in the top directory of the current server". Choosing the right URL for the right occasion will often reduce maintenance problems. A group of files that uses relative links between them can easily be moved to another directory or server. A file that links to the main search page with absolute path URLs can easily be moved to another directory or server. Luckily the shortest possible URL is often the best choice.

URLs are standardized in RFC 2396. Allowed and forbidden characters as well as characters with special meaning is of particular interest when developing Internet applications and web sites.