URL URL URL URL URL

What is a URL?

A URL (Uniform Resource Locator) is a universal naming format used to indicate a resource on the Internet. It is a printable ASCII character string which breaks down into five parts:

  • The name of the protocol: i.e. in a way the language used to communicate over the network. The most widely used protocol is the HTTP protocol (HyperText Transfer Protocol), the protocol which makes it possible to change Web pages into HTML format. However, many other protocols can be used (FTP, News, Mailto, Gopher, ...).
  • Login and password: enables the access parameters for a secure server to be specified. This option is unadvisable because the password is visible in the URL
  • The name of the server: This is a domain name for the computer hosting the requested resource. It is worth noting that it is possible to use the server's IP address which conversely makes the URL less readable.
  • The number of the port: this is a number related to a service allowing the server to know what type of resource is requested. The default port related to the protocol is port 80. So, when the Web service of the server is associated to port number 80, the port number is optional
  • The access path to the resource: This last part allows the server to know where the resource is located, i.e. generally the site (directory) and the name of the file requested.

A URL therefore has the following structure:

Protocol Password (optional) Server name Port
(optional if 80)
Path
http:// user:password@ www.commentcamarche.net. :80 /glossair/glossair.php3

For example, the following protocols may be used through URL:

  • http, for looking at web pages
  • ftp, for looking at FTP sites
  • telnet, to connect to a remote terminal
  • mailto, for sending an email
  • wais
  • gopher

The name of the file in the URL can be followed by a question mark then data in the ASCII format, this is additional data sent as parameters for an application on the server (a CGI script for example). The URL will then resemble a character string like this:

http://en.kioskea.net/forum/?cat=1&page=2

Encoding a URL

Considering that the URL is a medium for sending information over the Internet (to send data with a CGI script for example), it must be able to send special characters, yet URLs cannot contain special characters. In addition, certain characters are reserved because they have a meaning (the slash enables sub-directories to be specified, the characters & and ? are used to send data via forms..). Finally, URLs can be included in an HTML document, which makes it difficult to insert characters such as < or > in the URL.

That is why encoding is necessary! Encoding consists of replacing special characters with the character % (itself also becoming a special character) followed by the ASCII code of the character to be encoded in hexadecimal notation.

Here is the list of characters which require particular encoding:

Character URL encoding
Tabulation %09
Space %20
" %22
# %23
% %25
& %26
( %28
) %29
+ %2B
, %2C
. %2E
/ %2F
: %3A
; %3B
< %3C
= %3D
> %3E
? %3F
@ %40
[ %5B
\ %5C
] %5D
^ %5E
' %60
{ %7B
| %7C
} %7D
~ %7E

More information

The format of URLs is defined by RFC 1738:



Last update on Thursday October 16, 2008 02:43:22 PM.This document entitled « URL » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Best answers for « URL » in :
PHP 5 - Using an external URL with the function include Show PHP 5 - Using an external URL with the function include The option to include an external URL (ie absolute, in the form http://site.tld/url) with the function include is disabled by default from PHP 5 and latest version. Below is the two...
How to turn a URL into a hyperlink Show How to turn a URL into a hyperlink If you are using PHP, there is a simple way to turn a URL into a hyperlink when inserting the address into your PHP document. This process is mostly used to ease the users' search of external websites or...
Google - Search within the title or the URL Show Google-Search within the title or the URL Search in the title Search in the URL Note Google allows you to query only the pages containing a term in their URL or in the page title. Search in the title Simply use the following...
Converting a URL to a clickable hyperlink ShowConverting a URL to a clickable hyperlink With regular expressions, it is possible to transform any hyperlink URL of the form http://URL (or ftp://URL) or beginning with www. :
Favicon]having the icon of your site in the address bar Show[Favicon]having the icon of your site in the address bar To create an animated favicon or generate an ICO file Putting favicon online Notes You have probably noticed the presence of an icon to the left of the URL into the address...
[PHP5] Using an external URL with the include function Show[PHP5] Using an external URL with the include function Normally the option to include external URL (e.g absolute, shape http://site.tld/url) via the function include is disabled by default in php5 versions, to activate this option on...
Download Extreme URL Generator ShowExtreme URL Generator is an easy means to generate and backup a list of similar URLs. It provides a very intuitive interface which allows to generate a multitude of URLs with a few clicks. After generating the URL list, you can save it to a text...
URL manipulation attacks ShowIntroduction to URLs The URL (Uniform Resource Locator) of a web application is the vector that makes it possible to indicate the requested resource. It is a string of printable ASCII characters that is divided into five parts: The name of the...
HTML forms ShowForms Interactive forms let web page authors give their pages interactive elements, such as for receiving messages from their readers, much like the reply cards found in some magazines. The reader enters information by filling in fields or clicking...
Managing images in HTML ShowHow do you display images on a web page? Having a few images on a website can make it more attractive and user-friendly. However, it is important not to go overboard, since images can take a long time to load, and in some cases can make a document...