Is it possible to restrict access to a page based on a visitor's country?

For instance, only users in the US can view the FAQ page?


2 Answers 2


Luke Holder has created a plugin that would help you in this situation.

Geo Plugin for Craft CMS


I realise this is an old post, but it's something we've tackled recently and wanted to put out our solution.

If you're using CloudFlare you could use our Country Detect plugin, otherwise as John Moylan mentioned Luke Holder's Geo Plugin can achieve the same thing. The only advantage of our plugin is that it saves a bit of processing if you're already using CloudFlare.

You could then conditionally show content to US folks only at by something like this...

{% if craft.countryDetect.country == "US" %}
    {# Put your FAQs for USA here #}
{% elseif %}
    {# Content or redirect() goes here #}
{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.