Italy Cookies Choices Fix

by admin

You need to do the following steps to use Italy Cookies Choices properly.

1. You need to add the following rule into htaccess

RewriteCond %{HTTP_COOKIE} displayCookieConsent [NC]
# BEGIN WpFastestCache

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.berkatan.com [NC]
RewriteRule ^(.*)$ http\:\/\/berkatan\.com\/\ [R=301,L]
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit)
################# HERE #################
RewriteCond %{HTTP_COOKIE} displayCookieConsent [NC]
################# HERE #################
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !(comment_author_|wordpress_logged_in|wp_woocommerce_session)
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(iphone|midp|sony|symbos|nokia|samsung|mobile|epoc|ericsson|panasonic|philips|sanyo|sharp|sie-|portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc|android|blackberry|playbook|ipad|ipod|iemobile|palmos|webos|googlebot-mobile|bb10|xoom|p160u|nexus|touch|SCH-I800|opera\smini|SM-G900R4|LG-|HTC|GT-I9505|WAP-Browser|Nokia309|Casper_VIA).*$ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/\/index.html -f [or]
RewriteCond /home/username/public_html/wp-content/cache/all/\/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/\/index.html" [L]


AddDefaultCharset UTF-8

FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"


# END WpFastestCache

2. To add the following php into /wp-fastest-cache/inc/cache.php 100. line

if ( !isset( $_COOKIE['displayCookieConsent'] ) ){
    return;
}
public function createCache(){		
	if(isset($this->options->wpFastestCacheStatus)){

		if(isset($this->options->wpFastestCacheLoggedInUser) && $this->options->wpFastestCacheLoggedInUser == "on"){
			// to check logged-in user
			foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
				if(preg_match("/comment_author_|wordpress_logged_in|wp_woocommerce_session/i", $cookie_key)){
					return 0;
				}
			}
		}
        // ################# HERE #################
		if ( !isset( $_COOKIE['displayCookieConsent'] ) ){
			return;
		}
        // ################# HERE #################

		if(preg_match("/\?/", $_SERVER["REQUEST_URI"]) && !preg_match("/\/\?fdx\_switcher\=true/", $_SERVER["REQUEST_URI"])){ // for WP Mobile Edition
			return 0;
		}

		if(preg_match("/(".$this->get_excluded_useragent().")/", $_SERVER['HTTP_USER_AGENT'])){
			return 0;
		}

Related articles

Placeholder Image
Exclude Urls by Calling the Function Hook

It is very simple to exclude any url from the cache. You can call the following function in a theme…

Placeholder Image
To Clear Cache After Update

If a post or page is updated, the cache of post or page is cleared.

Placeholder Image
Plugin does not work after HTTPS Redirection

Usually the wp users use the plugins to redirect the sites to HTTPS.

Ready to get started?

Purchase your first license and see why 1,500,000+ websites globally around the world trust us.