check limit ip
-
We have restrictions for some countries. How can we have both the guest cache and our function run every time?
-
We want to implement it in such a way that users in some countries do not have access but search bots can
Hi,
please be more specific how did you block by country ? like rewrite rule or plugin or something ?
Do you have CDN service like QUIC cloud CDN or CloudFlare ?
is it your own server or shared hosting ?
Best regards,
Hello,
I use shared hosting. don’t have CDN.
I have written a plugin for this, but it does not work in cache mode.This means that the page may show and cache the limit for users, and this will show for everyone
I found this link :
https://wordpress.org/support/topic/cache-vary-for-different-group-of-country-with-cloudflare-geo-ip/But how can I have a different cache for search engines bot?
I do not want search engines to be limitedHi,
I have written a plugin for this
but how exactly did you do it ? like using $_SERVER[‘REMOTE_ADDR’] to check with online IP service or you just carry a MaxMind GeoIP DB file yourself or something ?
Best regards,
Well, my problem is that in guest mode, PHP does not work at all
Now I see that everything is done in htaccess.
Is there a way to say that I have a different cache for each country and a different cache for Google?yes , but you need to have something that
RewriteCondcan use as “checkpoint” or “anchor” , like cookie , HTTP header , or environmental variable from webserverthat’s why I asked you how did you detect country
I use GeoIP for detect county.
Do you recommend a specific person for this job?it’s not complicated thing
the hard part is how to get detection without involving PHP
you need to either have root access to server to set up GeoIP module for webserver , which is not possible I guess
other way is to have a CDN services in front , the CDN will send request header with country code you can use in rewrite rule
without one of these 2 things , this can not be done
Hi . Thank you for your guidance
I just had a question for you
The following code works well in my opinion:GeoIPEnable On
RewriteEngine on
RewriteRule. * – [E = Cache-Control: vary = other]RewriteCond% {ENV: GEOIP_COUNTRY_NAME} “country” [NC]
RewriteRule. * – [E = Cache-Control: vary = country]RewriteCond% {HTTP_USER_AGENT} Googlebot [NC]
RewriteRule. * – [E = Cache-Control: vary = SearchEngine]But it only works when it is in the LiteSpeed code block. And the light speed code changes every time.
How do I put this code in htaccess?
The topic ‘check limit ip’ is closed to new replies.