Help on using mod_rewrite to serve I18N static site

Posted by Guandalino on Server Fault See other posts from Server Fault or by Guandalino
Published on 2010-09-19T09:15:13Z Indexed on 2011/01/09 15:55 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

My static site www.example.com is translated in different languages and files are organized in this hierarchy:

/
  /de
    index.html
    seite-1.html
  /en
    index.html
    page-1.html
  /it
    index.html
    pagina-1.html

The root contains no files, just one subdirectory for each language the site is translated in, while subdirectories contain pages translated (both content and file name are) in the language corresponding to subdirectory name, de, en, it, etc.

The question is: how to configure mod_rewrite so that when a client visits www.example.com it is taken to the correct version of the site, falling back to english version if the required locale is not supported (i.e. Accept-Language header doesn't exist or specifies a language for which the site is not available, e.g. fr)?

Thanks for any pointer, I'm here to provide further details or feedback!

Best regards

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite