Uniform Resource Locator a.k.a. URL is a resource naming or locating format used to specify or address the resource. URL is very popular with the web where web sites and web resources are addressed or identified with URL format.
URL Syntax
URL has a very strict syntax which is defined in RFC 1738. It has the following syntax where some information about the resource is provided.
scheme://location:port/file-on-server.htm?querystring=1
scheme
is the protocol used to retrieve the URL resource which is generally HTTP, HTTPS, FTPlocation
is the address of the resource which generally starts with the `www` to specify the web resources.port
is the port number of the resource which is generally omitted because schemes have default port numbers that will be used implicitly. HTTP is 80, HTTPS is 443 etc.file-on-server.htm
is the resource name which is generally an HTML, JAVASCRIPT, CSS, IMAGE, etc.querystring
is a parameter provided to the resource which is used to put some data about the request.
As an example, this syntax is implemented in the following example.
https://www.poftut.com/what-is-chmod-777/
https
is the scheme or protocol we will use to communicate with the location or serverwww.poftut.com
is the location or server we will communicatewhat-is-chmod-777
is the resource we want to get and use
We can see this example do not provide a port or query string as the port is default value provided by HTTPS – 443 and there is no query string as we do not need for this case
URL Scheme
The scheme is the protocol we will use during communication with the remote server or location. There are different schemes invented on the internet. Below we will example the most popular of them below.
- HTTP is the main and most popular protocol used as a scheme. HTTP simply used to send a request to get remote resources which is generally an HTML, JAVASCRIPT, CSS, IMAGE, etc. HTTP is a stateless protocol where every request has to be managed separately by an HTTP server like Apache, Nginx.
- HTTPS is another popular protocol and expected to be the most popular protocol in the next years. HTTPS is just an HTTP protocol secured with the SSL.
- FTP or File Transfer Protocol is a very old protocol that is used to transfer files or bulk data between server and client.
- TELNET is an interactive remote management protocol that provides a shell for the remote system. TELNET is generally used in management systems and network devices.
URL Location
Location is the address of the remote system. Location can be also named as a server as a remote system will serve its resources to the client. Location can be expressed in different ways like below.
Domain Name
The domain name is used to address a specific location or system. Domain names are used via Domain Name System or DNS. Computer networks work with IP Addresses. But as human beings, we need a more simple solution to name and use systems. We can name systems with domain names in a human-readable format. We can use the following names as domain or location name in URL
www.poftut.com
poftut.com
test.poftut.com
Ip Address
Ip Address is a four-octet value which is delimited with the points like 192.168.1.2
. IP addresses are used to address systems in a computer network. So we can use an IP address as a location like below. In this example, we will set the location as 192.168.1.1
with the HTTPS scheme.
https://192.168.1.1/login.html
Ipv6 Address
IPv6 is a newer version of IP Address. We can use IPv6 address the same as IP address.
URL Port
Port is used to specify the location TCP or UDP port number. But TCP is the most popular port number with the HTTP, HTTPS protocols. Port numbers are generally used implicitly with the scheme or protocol like HTTP, HTTPS, FTP. So we do not provide port number explicitly. So the following examples are the same request or URL.
But we can specify the port number explicitly. In this example, we will specify the port number as 81 .
http://www.poftut.com:81/test.html
Here are some protocols/schemes and defacto port numbers.
- HTTP – 80,8080
- HTTPS – 443
- TELNET – 23
- FTP – 21
- LDAP – 389
URL Resource
A resource is the specific name of the resource we want to use on the remote location or server. The resource can be an HTML file, CSS file, JAVASCRIPT file, IMAGE file, PHP file, BATCH commands to run, API, etc. In regular usage, it will be a web page or HTML file. In this example, we will get the resource named run_command.html
http://www.management.com/run_command.html
URL Query String
When we request a resource can provide some Query String. Query String can be used to provide special parameters to a resource request. For example, if we want to use /
on poftut.com with the word linux
we can use we can string like below. The query string key will be s
and value will be linux
like below.
https://www.poftut.com/?s=linux
Providing User Name and Password In The URL
Up to now, we have used the location as a DNS name or IP address. But if we need to specifically use a user name and passwords we can use the following syntax.
scheme://username:password@location:port/resource?querystring
- username is used to specify the user like ismail, john, admin.
- password is used to put the password of the user where we need authentication to use a specified URL or resource.
Username and password generally required in the HTTP, HTTPS, and FTP protocols to use the remote resource. In this example, we will authentication with the admin user and password 34qFQwer4r+
.
ftp://admin:34qFQwer4r+@poftut.com/
HTTP URL Examples
In this part, we will provide different HTTP URL examples.
http://www.poftut.com
http://45.79.133.118/
http://www.poftut.com/?s=grep
http://45.79.133.118/?s=grep
http://www.poftut.com:80
http://www.poftut.com:80/what-is-chmod-777/
HTTPS URL Examples
In this part, we will provide different HTTPS URL examples.
https://www.poftut.com
https://45.79.133.118/
https://www.poftut.com/?s=grep
https://45.79.133.118/?s=grep
https://www.poftut.com:80
https://www.poftut.com:80/what-is-chmod-777/
Mail URL Examples
In this part, we will provide different Mail URL examples.
mailto:billgates@microsoft.com
FTP URL Examples
In this part, we will provide different FTP URL examples.
ftp://ftp.itu.edu.tr
ftp://ftp.microsoft.com
