Bump the language cookie expiry for visits during the expiry period

This ensures that if the user continues to visit the website then
they don't have to manually set the cookie again until they
stop visiting the website for more than the expiry period.
parent 6c3d5358
......@@ -137,12 +137,16 @@
# The GDPR does not apply and to satisfy the EU cookie law we can include
# some explanatory text around the form that sets the cookie.
# The use of POST requests will ensure each cookie is only set explictly.
# When a cookie is set by the user, update it on every visit so it doesn't
# expire unless the user stops visiting the website for the cookie duration.
# Since Apache mod_rewrite cannot inspect POST data, we use URLs instead.
RewriteEngine on
RewriteRule /intro/cn/setlang/([a-z]{2}(?:-[a-z]{2})?)/(.*) /$2 [last,redirect,cookie=lang:$1:%{HTTP_HOST}:40320:/:secure:]
RewriteRule /intro/cn/unsetlang/(.*) /$1 [last,redirect,cookie=lang:invalid:%{HTTP_HOST}:-1:/:secure:]
RewriteCond %{HTTP_COOKIE} /^lang=([a-z]{2}(?:-[a-z]{2})?)$/
RewriteRule . - [cookie=lang:%1:%{HTTP_HOST}:40320:/:secure:]
SetEnvIf Cookie "lang=(.+)" prefer-language=$1
Header append Vary cookie
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment