logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How include information on last page served in RewriteCond
Author
Didier Spaier



Joined: 08 Feb 2014
Posts: 1

PostPosted: Sat 08 Feb '14 12:39    Post subject: How include information on last page served in RewriteCond Reply with quote

Hi there,

here is the situation.

I run a the polyglot website http://slint.fr and my question is about "how to serve a page in the language preferred by the user, if available?"

At the moment I use Multiviews to add a language code to the requested URL according to the AcceptLanguage header (e.g. if "tr", serve index.html.tr instead of index.html), 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 will be in Turkish.

On every page, user can change language clicking on a link showing e.g. "uk" for Ukrainian. Now I want that once they do that all pages requested by the same client be served in the same language, unless/until user click on another language link.

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 my question is : knowing that when a user click 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 it exists.

I wish to avoid server side scripting (at present the website is 100% static).
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 07 Mar '14 17:48    Post subject: Reply with quote

You could use the %{HTTP_REFERER} variable in your rewrite rule.
Back to top


Reply to topic   Topic: How include information on last page served in RewriteCond View previous topic :: View next topic
Post new topic   Forum Index -> Apache