HTML URL

URL stands for Uniform Resource Locator or Universal Resource Locator. A URL is a specific character string that constitutes a reference to an Internet resource.

What is URL

URL is the global address of documents and other resources on the World Wide Web. Its main purpose is to identify the location of a document and other web resources available on the Internet, and specify the mechanism for accessing it through a web browser.

For instance, if you look at the address bar of your browser you will see:

https://www.tutorialrepublic.com/html-tutorial/html-url.php

— This is the URL of the web page you are viewing right now.


The URL Syntax

The general syntax of URLs is the following:

scheme://host:port/path?query-string#fragment-id

A URL has a linear structure and normally consists of some of the following:

  • Scheme name — The scheme identifies the protocol to be used to access the resource on the Internet. The scheme names followed by the three characters :// (a colon and two slashes). The most commonly used protocols are http://, https://, ftp://, and mailto://.
  • Host name — The host name identifies the host where resource is located. A hostname is a domain name assigned to a host computer. This is usually a combination of the host's local name with its parent domain's name. For example, www.tutorialrepublic.com consists of host's machine name www and the domain name tutorialrepublic.com.
  • Port Number — Servers often deliver more than one type of service, so you must also tell the server what service is being requested. These requests are made by port number. Well-known port numbers for a service are normally omitted from the URL. For example, web service HTTP is commonly delivered on port 80.
  • Path — The path identifies the specific resource within the host that the user wants to access. For example, /html/html-url.php
  • Query String — The query string contains data to be passed to server-side scripts, running on the web server. For example, parameters for a search. The query string preceded by a question mark, is usually a string of name and value pairs separated by ampersands, for example, ?first_name=John&last_name=Corner.
  • Fragment identifier — The fragment identifier, if present, specifies a part or a position within the overall resource or document. The fragment identifier introduced by a hash mark "#" is the optional last part of a URL for a document.
    When fragment identifier used with HTTP, it usually specifies a section or location within the page, and the browser may scroll to display that part of the page.
 

Note:Scheme and host components of a URL are not case-sensitive, but path and query string are case-sensitive. Usually the whole URL is specified in lower case.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.