6.1. Understanding URLs

A Uniform Resource Locator (URL) is the unique address of a resource (usually a document) on the Web. This addressing scheme allows user agents and other Internet-enabled programs to find documents and ask for their contents.

URLs are made up of several different parts, all working together to provide a unique address for Internet content. Figure 6-1 shows an example of a typical URL and its various parts.

The various pieces of the URL are described as follows:

  • The protocol section is a protocol abbreviation followed by a colon. For example, the standard HTTP protocol is designated as http:. Another popular protocol supported by many user agents is File Transfer Protocol (FTP), designated in URLs as ftp:.

  • The server name is prefixed with two slashes and typically includes a fully qualified domain name, as in //www.example.com. The www is the server name, and example.com is the domain. Note that it is a misnomer that Web servers need to be named www; although www (World Wide Web) is a common convention, the server name can be any valid name. For example, the fully qualified name of the U.S.-based server for the Internet Movie Database is us.imdb.com. Note that an IP address can be specified instead of a server name.

    Figure 6-1. Figure 6-1

    The URL can also include a username and password before the server name (description follows). This is especially true ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.