Wednesday, 11 February 2015

PARTS OF URLs

 Most URLs contain (roughly) three parts: the protocol, the host name, and the directory or filename (see figure 5.15)
FIGURE 5.15 URL parts.









The protocol is the way in which the page is accessed; that is, the means of communication your browser use to get the file. If the protocol to talk to the server. In order for a link to work, the host named in the link must be running a server that supports the protocol that’s specified. So if you use an ftp URL to connect to www.example.com, the link won’t work if the serer isn’t running FTP server software.
The hostname is the address of the computer on which the information is stored, like www.goole.com,ftp.aaple.com, or www.alot.com.the same hostname can support more than one protocol, as follows:
http://example.com

ftp://example.com
it’s one machine that offers two different information services, and the browser will use different methods of connecting to each. As long as all three serves are installed and available on that system, you won’t have a problem.
The hostname part of the URL might include a port number. The port number tells your browser to open a connection using the appropriate protocol on a specific network port. The only time you’ll need a port number in URL, is if the serve responding to the request has been explicitly installed on that port. If the server is listening on the default port, you can leave the port number out. This issue is covered in day 17, “designing for the real world.”
If a port number is necessary is necessary, it’s placed after the hostname but before the director, as follows:
http://my-public-access-unix.com:1550/pub/file
if the port is not included, the browser tries to connect to the default port number associated with the protocol in the RUL. The default port for HTTP is 80, so a link to http://www.example.com:/are equivalent.
Finally, the directory is the location of the file or other form of information on the host. The directory does not necessarily point to a physical directory and file on the server. Some web applications generate content dynamically, and just use the directory information as an identifier. For the files you’ll be working with while learning HTML, the directory information will point to files that exist on your computer.

No comments:

Post a Comment