Hasaccess problems
-
Hi guys,
I hope you are well. My developer has added the code below to unlock paid articles from visitors via Google and Google news etc. That way people that are new to our site can read one free article. If they then click on a link to another article or visit our site directly, they will see locked articles and have a chance to sign up.
Before we added Autoptimze the code had no problems. But with Autoptimze, sometimes the articles are locked, and sometimes they are not locked so it seems that our code is randomly working. How can we make Autoptimze ignore that code?
We use Autoptimze for this specific function “Aggregate all linked CSS files?” if not the google crawler will not load all of our CSS files. We also pay for CriticalCSS.
So we really need our code and Autoptimze to work.
We also use Cloudflare APO and have our entire site on their system. But we can see that just clearing the cache via Autoptimze will be enough to get the code working.
Here is the code so you what I mean.
if (preg_match('/google/i', $_SERVER['HTTP_USER_AGENT'])) { $hasaccess = true; } elseif (preg_match('/google/i', $_SERVER['HTTP_REFERER'])){ $hasaccess = true; } elseif (preg_match('/ampproject/i', $_SERVER['HTTP_REFERER'])){ $hasaccess = true; } else { // you can do something here }I hope this makes sense.
Thanks
AlexThe page I need help with: [log in to see the link]
The topic ‘Hasaccess problems’ is closed to new replies.