Fwd: How to serve next page requested by a user in the same language than the last one served to that user.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

I run a the polyglot website http://slint.fr.

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 "^/slint.fr/(bs|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%
static).

Thanks in advance for any clue.

Cheers, Didier



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux