0

I have a wordpress site that needs to be accessible by only UK, EU & US users. I'm hoping to do this using Cloudways geoIP so I can avoid having to use a plugin (as they run into caching usage problems).

I have the below rewrite rule in htaccess, but although it works for the UK & EU, I can't seem to get it to work for the US. So with the below, everyone outside GB, EU & US should redirect to a licensing page.

RewriteEngine on
RewriteCond %{HTTP:X-FORWARDED-COUNTRY} !(GB|US)$ [OR]
RewriteCond %{HTTP:X-FORWARDED-CONTINENT} !^EU$
RewriteRule ^(.*)$ https://example.com/licensing [L]

Edit: have updated to use country and continent as pointed out. This should be saying if not UK, US or EU then redirect, but I can't seem to get those results.

Using the examples at: https://support.cloudways.com/en/articles/5126366-how-to-use-geoip-with-your-application

ben_6970
  • 1
  • 2

0 Answers0