A URL which stands for uniform resource locator is a unique identifier used to locate a resource on the web.
A simple typical URL would be like this:
The first part of a URL — https:// — is called the scheme. It is also known as the protocol and defines how resources accessed through the specified URL should be displayed. HTTPS stands for Hypertext Transfer Protocol Secure and specifies that resources served from the URL should be displayed in hypertext format (i.e HTML or web pages). HTTPS is a secure version of the now outdated HTTP.
Many people usually confuse URLs with the domain name. But, a domain name is a component of a URL. A domain name points to the entire web property, while a URL points to a specific page or resource on the web property. Think of it as a project folder with nested folders and files. A domain name points to the entire folder, while the entire URL points to a specific file in the project folder.
This part of the URL is known as the path. Remember the project and file analogies from the previous section? Well, /blog is a sub-directory (i.e. a nested folder) that contains the desired file: about.html.
Sometimes, a URL can go beyond the basic 3 components which I have explained above to include either a query or a fragment.
A URL with a query looks like so:
This part of the URL is known as a query. ‘?’ is a reserved character that signifies the start of the query string. Queries are used to retrieve specific data from a web resource. In the URL example below, we’re trying to retrieve the data stored in the video directory with an id of 45. This is usually used to facilitate dynamic web experiences.
For fragments, a typical URL with a fragment looks like so:
This portion of a URL is known as a fragment. # indicates the start of a fragment identifier. A fragment points to a portion of a page, like a footer or a sidebar, and is often an id attribute of an HTML element.
Blog Credits: Linda Ikechukwu