korx/Korx.CookieComplier/master/Demo/.htaccess - Htaccess File

korx/Korx.CookieComplier/master/Demo/.htaccess

# © 2012 Korx Limited

# Set _allow_cookies automatically if outside the EU
<IfModule mod_geoip.c>
    SetEnvIf GEOIP_COUNTRY_CODE "^((?!(BE|BG|CZ|DK|DE|EE|IE|GR|ES|FR|IT|CY|LV|LT|LU|HU|MT|NL|AT|PL|PT|RO|SI|SK|FI|SE|GB))[A-Z]{2})$" _allow_cookies
</IfModule>

# Allow cookies if preference cookie is set
SetEnvIf Cookie "^.*_allow_cookies=1.*$" _allow_cookies

# Disallow cookies if DNT header sent
SetEnvIf DNT "1" !_allow_cookies

# Add a cookie in the request if we're allowing cookies and it's not there already
SetEnvIf Cookie "^.+$" _has_cookies
RequestHeader set Cookie "" env=!_has_cookies
RequestHeader edit Cookie "^(.*?)(;s*|)_allow_cookies=1(.*)$" "$1$3" env=_allow_cookies
RequestHeader edit Cookie "^(.*)$" "$1; _allow_cookies=1" env=_allow_cookies
SetEnv !_has_cookies

# Remove all cookies if we don't allow them, except for the preference cookie
Header edit Set-Cookie "^((?!_allow_cookies).)*$" "$2" env=!_allow_cookies

On Github License

Files

Download PDF of Htaccess file

Comments

Apache