[an error occurred while processing the directive]
How to Configure?
All
the aforementioned capabilities of the server are configured via config files.
The relevant directives are described below.
Since ver. PL18 (the one under beta-testing now), the directives of config files and
the general idea have changed significantly. Therefore, the description of the directive syntax for
ver. PL18 and subsequent ones is given in a separate document.
Directives Used for Configuration
- CharsetTable
- Serves for describing the main charsets used by the server.
Syntax:
CharsetTable Official_Name Table1 [Table2] Language
- Official_Name
- The official name of the charset (for example, windows-1251, koi8-r, ibm866,
iso_8859-5:1988, etc.)
- Table1
- The name of the file containing the table that establishes the correspondence
between the "internal" representation of documents and documents in the given charset
that are sent to the client.
- Table2
- The name of the file containing the table that establishes the correspondence
between the "internal" representation of documents and documents in the given charset
that are received from the client. This parameter may be absent; in this case, the server
uses the reversed Table1.
- Language
- The name of the language to which the given charset belongs. This name should be
defined in conf/srm.conf by the AddLanguage and
LanguagePriority directives.
- Examples:
CharsetTable iso_8859-5:1988 conf/koi-iso.tab ru
CharsetTable ibm866 conf/koi-alt.tab ru
CharsetTable windows-1251 conf/koi-win.tab ru
CharsetTable koi8-r conf/koi-koi.tab ru
Each directive describes only one charset. If there are several virtual servers and each of them
must use several charsets, these charsets should be described for each virtual server in the
<VirtualHost> section.
CharsetAlias
Serves for describing the aliases of the given charset.
Syntax:
CharsetAlias Official_Name Alias1 Alias2 Alias3 ...
- Official_Name
- The official name of the charset in question. Should be defined prior to this directive by the
CharsetTable directive.
- Alias1 Alias2 ...
- Aliases for the given charset.
- Examples:
-
CharsetAlias iso_8859-5:1988 iso-ir-144 iso_8859-5 cyrillic iso-8859-5
CharsetAlias iso_8859-5:1988 iso8859-5 iso-8859.5 iso8859.5 iso
CharsetAlias ibm866 csibm866 866 cp866 x-cp866 x-ibm866 cp-866 alt
CharsetAlias windows-1251 win x-cp1251 cp1251 cp-1251
All aliases should be individually defined for each virtual server.
CharsetPriority
Serves for setting the priorities of the charsets configured. It may be of importance
if the client's request envisages equal weight coefficients for different charsets or if
NativeCharset is not specified; then, the highest-priority charset will be used.
Syntax:
CharsetPriority Charset1 Charset2 Charset3 ...
- Charset1 Charset2 ..
- The charset names in the order of decreasing priority (the leftmost one has the
highest priority). All charset names should be defined prior to this directive by the
CharsetTable directive.
- Example:
-
CharsetPriority windows-1251 koi8-r ibm866
The charset names here should be only official names rather than aliases.
NativeCharset
Specifies the name of the default charset for a given server. Syntax:
NativeCharset Charset_Name
- Charset_Name
- The official name of the default charset for a given server.
- Example:
NativeCharset koi8-r
NativeCharset windows-1251
Specified independetly for each virtual server.
Charset_Name should be specified prior to this directive by the CharsetTable directive.
Attention! For some reason unknown, many people believe that the NativeCharset directive
describes the encoding used by the server for storing documents on disk. This is not true. NativeCharset
describes (only) the encoding of the response if all other ways of determining the client's
encoding (the Accept: header, the URI prefix, User-Agent) fail. To change the on-disk encoding,
one should redefine the charset description. It may be done for the server as a whole or
for a separate virtual server.
AgentCharset
Describes the charset that may be used when the server finds the client-identifying substring in
this client's request. The server searches for this substring in the User-Agent field of the
request. Syntax:
AgentCharset Charset_Name Pattern1 Pattern2 Pattern3 ...
- Charset_Name
- The official name of the charset
- Pattern1 Pattern2 ...
- Patterns for search in the User-Agent field of the client's request.
- Examples:
AgentCharset windows-1251 AIR_Mosaic IWENG/1 MSIE WinMosaic (Windows (WinNT;
AgentCharset windows-1251 (Win16; (Win95; (16-bit)
AgentCharset koi8-r Arena Ariadna Macintosh OmniWeb Sextant PRD (X11
AgentCharset ibm866 DosLynx
All patterns are substrings rather than regular expressions.
BadAgent
Some client's programs inadequately react to MIME - for example, when upon receiving the
header like
Content-type: text/html; charset=koi8-r; level=3
To prevent the server from providing charset=... to such client's programs,
this directive is used. Syntax:
BadAgent Pattern1 Pattern2 Pattern3 ...
- Pattern1 Pattern2 ...
- The substrings in the User-Agent field of the client's request that will tell the server
to skip providing charset=....
- Example:
- BadAgent lynx/2.1 arena
All patterns are substrings rather than regular expressions.
As Andrey Chernov rightly noted,
specifying only the browser name without the actual version in this directive probably will
mean future trouble. Unfortunately, up to ver. PL14 inclusive, the configuration file
distributed together with Apache-RUS contained this error: Lynx and MSIE were specified
as Bad Agents. Since ver. PL15, this error has been removed. The correct entry (by the date
when this text was written, that is, by April 21, 1997) looks as follows:
BadAgent arena Lynx/2.0 Lynx/2.1 Lynx/2.2 Lynx/2.3 Lynx/2.4 "MSIE 2.0;"
NoSoBad
Exceptions from the BadAgent list. This directive was introduced because
new versions of Lynx require that charset... should be specified, whereas
older versions of the same program behave inadequately in this case. Since the number
of old versions is very large, it is easier to describe new ones as exceptions. Syntax:
NotSoBad pattern1 pattern2
All patterns are substrings rather than regular expressions. As a rule, this directive is used
for distingushing some versions of a program from all other versions of the same program:
BadAgent lynx
NotSoBad Lynx/2.7 Lynx/2.6 Lynx/2.5FM
All versions of Lynx except for 2.5FM, 2.6, and 2.7 will be regarded as Bad Agents.
RejectErrorCharset
This directive describes the actions of the server upon receiving an unknown charset
in the client's request. Syntax:
RejectErrorCharset On/Off
When this parameter is set to On, the server will not provide the document in the
native charset but will inform the client that there was an error in the request. When the
parameter is set to Off, it will provide the document in any case, in some form available to it.
The default value is Off.
NoHostnameCharset
By default, if the client does not request a specific code page, the server tries
to determine it according to its (server's) name, for example, win.www.company.com.
This directive makes it possible to forbid the server to search for the desired charset
in its own name. Syntax:
NoHostnameCharset On/Off
The default value is Off.
NoUriCharset
This directive makes it possible to forbid the server to determine the charset requested
by the client from the URI. For example: by default, the server "thinks"
that documents like
http://www.company.com/win/name.html
should be sent in the windows-1251 encoding.
The use of the
NoUriCharset On
directive will make the server show this document using the native code page.
CharsetAgentPriority
Specifies the priority in the server's search for the required charset between the
URL and User-Agent. Syntax:
CharsetAgentPriority On/Off
When this parameter is set to On, the server will first analyze the User-Agent
field. Upon finding some template that is familiar to it, the server will come to a decision
about the configured charset according to the AgentCharset directives. If such
a template is not found, the server will try to find the charset name in the prefix of the
name of the virtual server to which the request is addressed or in the prefix of the URI
requested.
When the parameter is set to Off (the default value), the order of search is opposite.
[an error occurred while processing the directive]