Web Authoring: Complex URLs

Details of HTTP URLs


There are a number of additional considerations that can complicate the resource id portion of a URL. Some of these apply to non-HTTP URLs; for example, it should be pointed out that the resource id for a Gopher URL is not actually a directory path (although it often looks a great deal like one), but is actually composed of a numeric Gopher "type code" followed by a "selector string" (which is usually file and directory information, but not always.)

URLs that link to scripts

Nevertheless, the most frequent reason for a URL to be more complex than the preceeding examples is the involvement of a server-side script. There is more to this particular subject than we will go into in this seminar, but the essential idea is not too difficult.

There are times when a static document is not sufficient for the desired purpose. The Web provides a solution in these cases. Rather than depend upon a document in an unchanging file, the Web makes provision to request that the server run a program on the client's behalf. This program can do any of a number of things, including generating HTML "on-the-fly". (This is how a number of the really neat things on the web work--such as navigation bars, guestbooks, forms, and so on--unfortunately, it isn't all that easy to do. There are some canned programs--for specific purposes--that you can use, be we won't be able to detail any of them in this seminar.)

The following URL shows a hypothetical example of a link to such a special-purpose facility:

http://www.fake.com/cgi-bin/program

This looks like a fairly ordinary URL, except that it isn't. The "cgi-bin" part is a clue that a script is involved. The "program" is the name of the program (running on the same machine as the web server program) that does the magic. This program can be written in C, or using a UNIX shell scripting language, or in PERL (which is why we won't be talking about how to do write such programs today.) This can get even more complex:

http://www.fake.com/cgi-bin/program/subdir/file?query

This example adds a path specification beyond the program name: this is for a file (such as a data file) that the program is to use. And the "query" part, after the question mark, "?," is an argument to be passed to the program (such as a serach string).

URLs that link within a document

There are also URLs that don't stop with the specification of which document to get. These include a reference to a specific, named, location within the document. This alllows you to build an index or a table of contents that will have links that will let the reader jump directly to the place they should begin reading. It works in a similar fashion to the cross-reference facility of many word processors. It looks like this:

http://www.fake.com/the-file.html#where

Where the "where" part (following the pound-sign, "#") indicates a (previously-defined) location within the document "the-file.html." We will discuss how to accomplish this on Day 3, but if you want to see how it works, check out the glossary.


 Agenda  Next  Prior
SDR, 4 Aug 1995.