My spec:
- Wordpress
- W3 Total Cache
- Cloudflare
I'm using Cloudflare IP Geolocation to detect country of visitor and based on that I want to serve different content depends on server headers
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
- returns country code in ISO 3166-1 Alpha 2 format, e.g. GB for Great Britain
Of course it won't work with W3 Total Cache. It will save cached version once, and then serve this to everyone, ignoring country. (URL always stays the same)
Any ideas how can I serve different versions of cached website depends on this header?
I know I can do it easily with javascript and ajax, but I have to do it with php.