Download Introduction to the Apache Web Server

Transcript
9.2
Negotiation Methods
9.2.1
MultiViews
Options +MultiViews
Multiple variants of a particular document are placed in a directory, and MultiViews turned on for that
directory. Following the algorithm described in the documentation, the file that most closely matches the
preferences specified by the user is chosen and returned.
Example:
Client requests the resource index
In the directory, we have the following files:
index.html.en
index.html.fr
index.html.de
index.txt
index.pdf
If the client browser specifies that it prefers to receive documents in German, then this client will receive
the document index.html.de, because it most closely matches the client’s requirements.
Content negotiation via MultiViews is very slow, as it must get a directory listing in order to consider the
files that match the name of the resource requested.
Important to note that the client can request the resource as index rather than index.html, in order to
consider a wider range of possible variants of the file. If the resource index.html is requested instead, the
files index.txt and index.pdf would not even be considered.
9.2.2
Type map files
Rather than leaving Apache to fend for itself, you can do some of the work for it by creating a type-map
file, listing all variants of a particular document, and the information about these variants.
This file would be called either example.var or example.html.var, depending on whether you wanted to
negotiate for the URL “example” or “example.html”.
54