URL

From Pulsed Media Wiki

URL

A URL (Uniform Resource Locator) is a standardized text string that shows how to access a resource on the internet. It's the most common type of URI (Uniform Resource Identifier), mainly used to locate web pages, images, files, and other data on the World Wide Web.

In simple terms, a URL is an address that tells your web browser exactly where to find something online and what method (protocol) to use to get it.

Structure of a URL

A URL has several parts, though not all are always present. Its general structure is: scheme://authority/path?query#fragment Here's what each part means:

Scheme: The first part, followed by a colon (:), indicating the protocol to use (e.g., http, https for web, ftp for file transfer, mailto for email). Authority: Usually comes after // and specifies the server or host. It includes: [userinfo@] (Optional): Username and password (rarely used now). Host: The domain name (e.g., www.example.com) or IP address of the server. Your browser uses DNS to find the IP address. [:port] (Optional): The port number to connect to (e.g., 80 for HTTP, 443 for HTTPS, if not specified). Path: Identifies the specific resource on the host, using slashes (/) like folders and file names in a file system. Query: An optional part, starting with ?, containing data for the server, often for dynamic content. It uses key-value pairs separated by & (e.g., ?item=shoes&color=blue). Fragment: An optional part, starting with #, that points to a specific section within the resource (like a section on a web page). Your browser processes this; it's not sent to the server.

Examples

Let's look at a few examples:

https://www.example.com:8080/path/to/resource.html?query=value#section

Scheme: https Authority: www.example.com:8080 Host: www.example.com Port: 8080 Path: /path/to/resource.html Query: query=value Fragment: section ftp://user:password@ftp.example.com/public/file.txt

Scheme: ftp Authority: user:password@ftp.example.com Userinfo: user:password Host: ftp.example.com Path: /public/file.txt mailto:user@example.com

Scheme: mailto Path: user@example.com (Note: structure varies by scheme)

Relation to URIs and URNs

A URL is a type of URI (Uniform Resource Identifier). URI is a broader term covering URLs (which tell where a resource is) and URNs (which name a resource, like an ISBN, without saying where it is). So, all URLs are URIs, but not all URIs are URLs. Still, 'URL' is often used generally for web addresses.

Encoding

URL encoding, or percent-encoding, is how special characters (like spaces or ?, #) that aren't allowed or have special meaning in a URL are represented. These characters are replaced by a percent sign (%) followed by their two-digit hexadecimal code (e.g., a space becomes %20). This mostly applies to characters in the path, query, and fragment.

See Also

DNS