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:
The URL Syntax
The general syntax of URLs is the following:
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
- 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
- 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,
- 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,
- 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.