document language preference

Date: Mon, 10 May 1999 18:29:50 -0300 (ADT)
From: Michael Smith <michael@csuite.ns.ca>
To: csuite-tech@chebucto.ns.ca
Precedence: bulk
Return-Path: <csuite-tech-mml-owner@chebucto.ns.ca>

next message in archive
no next message in thread
previous message in archive
previous message in thread
Index of Subjects

Index of Subjects
On Mon, 10 May 1999, Ian White wrote:

> I have noticed that this occurs on a plain CSuite-1.0 install but
> chebucto.ns.ca doesn't seem to have this problem. It appears that the
> rewrite rules need to be changed to tell it that if a file doesn't have an
> extension that it should be en. Ideas?

You're right. The stock CSuite 1.0 rewrite rules get confused if French is
anywhere in the language prefs (even below English). I fixed them on CCN.
Here're our rewrite rules:

RewriteEngine On

RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 fr
RewriteCond     %{REQUEST_FILENAME}                     ^/~(.*).html$
RewriteCond     %{REQUEST_FILENAME}.fr                  -f
RewriteRule     (.*)                                    $1.fr
[R,L]

# michael 23 dec 1998 - The first cond is so that having fr{,-..} as a 
# 2ndary language (behind English) doesn't make pages show up in French.
# It's based on my guess that all language codes begin with a 2-letter
# abbrev followed by an optional -?? subcode.
# The idea is to filter out a pref that looks like
# HTTP_ACCEPT_LANGUAGE: *(en|en-??),*fr*
# This also filters out a pref that looks like
# HTTP_ACCEPT_LANGUAGE: fr, ...... en, .... fr-BE
# but too bad.

RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 !en(-..)?,(.*)fr
RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 fr
RewriteCond     %{REQUEST_FILENAME}                     ^(.*).html$
RewriteCond     %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.fr  -f
RewriteRule     (.*)                                    $1.fr [R,L]

# michael 25 sept 1998 - http://www.chebucto.ns.ca/SomeDir/ produces
# http://www.chebucto.ns.ca/SomeDir//index.html.fr without this
RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 !en(-..)?,(.*)fr
RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 fr
RewriteCond     %{DOCUMENT_ROOT}%{REQUEST_FILENAME}     -d
RewriteCond     %{DOCUMENT_ROOT}%{REQUEST_FILENAME}index.html.fr        -f
RewriteRule     (.*)                                    $1index.html.fr [R,L]

RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 !en(-..)?,(.*)fr
RewriteCond     %{HTTP_ACCEPT_LANGUAGE}                 fr
RewriteCond     %{DOCUMENT_ROOT}%{REQUEST_FILENAME}     -d
RewriteCond     %{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index.html.fr    -f
RewriteRule     (.*)					$1/index.html.fr [R,L]



And for our French-only VH, reseau.chebucto.ns.ca:

RewriteEngine On

RewriteCond    %{REQUEST_FILENAME}                     ^/~(.*).html$
RewriteCond    %{REQUEST_FILENAME}.fr                  -f
RewriteRule    (.*)                                    $1.fr [R,L]

RewriteCond    %{REQUEST_FILENAME}                     ^(.*).html$
RewriteCond    %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.fr  -f
RewriteRule    (.*)                                    $1.fr [R,L]

RewriteCond    %{REQUEST_FILENAME}                     ^/$
RewriteCond    %{DOCUMENT_ROOT}/index.html.fr          -f
RewriteRule    (.*)                                    /index.html.fr [R,L]

RewriteCond    %{REQUEST_FILENAME}                     ^/$
RewriteCond    %{DOCUMENT_ROOT}/Home.html.fr           -f
RewriteRule    (.*)                                    /Home.html.fr [R,L]


Michael

next message in archive
no next message in thread
previous message in archive
previous message in thread
Index of Subjects