Email Spam Filter:
jwSpamSpy
Try it for free!


About spam / "419" / Blog
jwSpamSpy
Recent spam domains
Spam domain blacklist

Software
Links
joewein.de
joewein.net
Contact
Google

 

Multiple language support with the Apache webserver

Problem: Your web host uses Apache and you want visitors to your website to see pages in the preferred language:
You have a bilingual or multilingual website. Creating different pages under different URLs to accomodate different language versions and having the user enter those URLs is cumbersome and errorprone. Ideally, this should be transparent and automatic.

Explanation:
Users from different countries have different languages configured in their web browser (IE 5.5 english: Tools / Internet Options / Language). You want users to see the pages they visit in whatever language most closely matches their preference or a default language, if no matching choice is available. If your website is used on a server that runs Apache (by far the most popular web server), there is a way of making multi-language support fully transparent to the user.

Solution: First you need to create a text file called .htaccess in the directory that holds you files. You can create this as htaccess.txt on your Windows machine, upload it using an FTP program and then rename it to the proper name using FTP. List all languages you want to support and provide a default priority list. For example, if our site supports English (en) and German (de) and we want to provide German if no preference is indicated by the browser, the following file is acceptale:

Options +MultiViews 
AddLanguage de de 
AddLanguage en en 
LanguagePriority de en

The "de" and "en" values to the right indicate, that Apache should lok for specified files with a .de or .en tag added to the end if the basic name is not found. For example, if the user looks for /index.htm and this file does not exist, Apache will then look for /index.htm.de, /index.htm.en and /index.htm.htm (in that order). Make sure that a language unspecific file such as index.htm.htm exists, or Browsers requesting a language other than these two will be caught out without a match. So if you want to provide German and English, with all other Browsers defaulting to English, it would be sufficient to create a *.htm.de file (German) and a *.htm.hm file (English).

Further reading (in German):
http://www.exine.de/server/apache_htaccess_language_support.shtml