httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Didier Spaier <>
Subject [users@httpd] Fwd: How to serve next page requested by a user in the same language than the last one served to that user.
Date Mon, 10 Feb 2014 13:17:00 GMT
Hi there,

I run a the polyglot website

Currently I add a language code to the requested URL according to the
AcceptLanguage header, but this information doesn't always match user wish
and I was told that serving different filenames for the same requested URI
can prevent proper pages indexing by search engines.

So, I will now store web pages in each language in a specific directory,
e.g. subdirectories en, it ru, tr, etc. For instance /tr/index.html is
in Turkish but /fr/index.html is in French

On every page, user can change language clicking on an hyperlink to a
page in corresponding directory (provided the same page exists in that
language, of course).

I want that when a user has requested a localized page (i.e. in a
directory other than /en), request of pages from the same user that not
include a per language directory in their path be rewritten to the page
with the requested filename in the same directory if it exists, else to
the page with the same filename in the /en directory.

I know that I could set a cookie or use HTTP-REFERER for that, but
possibly the  browser can be set to refuse cookies or not sent the Referer
HTTP header so I'd prefer to avoid that.

So my question is : knowing that when a user clicks on a language link we
serve a  page in the corresponding directory, how could I reuse that
information  for next request of the same client (same IP address),
including it in a RewriteCond directive so that I can serve requested
page in the same language directory, if that page exists there.

I have considered SetEnvIf directive like this one:
SetEnvIf Request_URI "^/|de|el|en|es|fr|id)/.*$" <IP.LANG>=$1
but do not know the variable name I<IP.LANG> cna be set as the Remote_Addr.

I have also considered scanning the access log, to find that information
I don't know any way to do that.

I wish to avoid server side scripting (at present the website is 100%

Thanks in advance for any clue.

Cheers, Didier

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message