Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



VPS v2: mod_negotiation: The Apache Module

bullet Introduction

The Apache Web Server has the ability to look at the language preference specified by a web browser client (such as Netscape Navigator or Microsoft Internet Explorer) and return the content of different files depending on that preference. This ability, termed Content Negotiation, is a simple yet very powerful Apache feature.


bullet Installation

To use mod_negotiation, you will need to uncomment the following line in your /usr/local/apache/conf/httpd.conf file and then run restart_apache.

#LoadModule negotiation_module libexec/


bullet Configuration

Make the following additions and modifications to your web server configuration file (~/www/conf/httpd.conf).

  1. Add language directive using the AddLanguage directive, like this:

    AddLanguage en .en
    AddLanguage es .es
    AddLanguage fr .fr
    AddLanguage de .de
    AddLanguage it .it
    AddLanguage jp .jp

    The AddLanguage directive associates file extensions (.en .es .fr .de .it .jp) with corresponding language abbreviations (en es fr de it jp). The abbreviations are predefined and can be located in any of the latest generation web browser clients.

    • Netscape Navigator

      Edit -> Preferences -> Navigator -> Languages -> Add

    • Microsoft Internet Explorer

      Tools -> Internet Options -> General -> Languages -> Add

  2. Add a language priority directive using the LanguagePriority directive, like this:

    LanguagePriority en es fr de

    The LanguagePriority directive allows you to give precedence to some languages in case of a tie during content negotiation or if the browser client does not specify a language priority (older web browsers). Just list the languages in decreasing order of preference.

  3. Add the MultiViews option to the Options directive that is part of your <Directory /usr/local/etc/httpd/htdocs> definition. For example, your web server configuration file probably is set up this way currently:

    <Directory /usr/local/etc/httpd/htdocs>
    # This may also be "None", "All", or any combination of "Indexes",
    # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you (or at least, not yet).
    Options Indexes FollowSymLinks

    Add the MultiViews option like this:

    Options Indexes FollowSymLinks MultiViews

    The MultiViews option can also be added to the Options definition in .htaccess files.


bullet Serving Language-Specific Content

Create and upload language-specific content to your Virtual Private Server using the appropriate extensions. For example, create index.html.en,, and files in addition to an index.html file. When a web browser client requests index.html, the web server will analyze the language preference of the web browser client and serve the appropriate index.html.* file seamlessly and transparently.

NOTE: If the language preference submitted by the web browser does not match any of the type definitions configured in your web server and documents you have authored, then the web server will return a 406 error (i.e. the resource was found, but could not be delivered because the type of the resource is incompatible with the acceptable types indicated by the accept or accept-encoding headers sent to the web server by the web browser client). For example, if a client will only accept Greek content (el) and nothing else, and you have only authored content in English, Spanish, and German, then the web browser client will report a 406 error. It may be wise to capture 406 errors with a custom ErrorDocument script.


bullet More Information

See the following.

Toll Free 1-866-GSP-4400 • 1-301-464-9363 •
Copyright © 1994-2016 GSP Services, Inc.