What Is the Structure of a URL


What Is the Structure of a URL? - XHTML 1.0 Tutorials - Understanding Hyper Links and URLs

✍: FYIcenter.com


The structure of a URL is defined by the URL specification, see http://www.ietf.org/rfc/rfc2396.txt. Generally, a URL consists of 7 parts:

  • Protocol Name - Identifies the communication protocol through which this resource is made available, like "http://" or "ftp://".
  • Host Name - Identifies the computer host that manages this resource, like "www.w3.org", or "dev.fyicenter.com".
  • Port Number - Identifies the communication port where hosting computer is taking requests, like ":8080".
  • Path Name - Identifies the directory where the resource is located, like "/", or "/faq/".
  • File Name - Identifies the file name of the resource, like "index.html", or "xanimal18.jpg".
  • Bookmark - Identifies a bookmark within the target document, like "#narrow".
  • Query String - Provides parameters to the resource manager, like "?hl=en&q=xhtml".

If you have a URL, you can easily break it into parts. For example, "http://www.fyicenter.com:8080/faq/xhtml/index.html#footer?q=test" can be broken into 7 parts like this:

  • "http://" - Protocol Name.
  • "www.fyicenter.com"- Host Name.
  • ":8080" - Port Number.
  • "/faq/xhtml/" - Path Name.
  • "index.html" - File Name.
  • "#footer" - Bookmark.
  • "?q=test" - Query String.

2007-05-12, 4799👍, 0💬