Block IP addresses for Specific Pages


I’m working on a WordPress site for a small company. We will be adding some “Buy Now” (e-commerce) pages for our products, but we want these “Buy Now” pages to block all countries except North American countries. We are only ready to sell to North American countries for the time being. Other pages will still be accessible to the blocked countries.

This site is hosted so I’m not able to configure hardware or web server software like Apache or Nginx. I’ve only found Apache only solutions such as GeoIP2/mod GeoIP for Apache, or websites which create an Apache .htaccess file to block ip’s like

But is there a Wordpress plugin or Wordpress-specific solution that can do this? It’s likely that our site hoster would not allow any customization of Apache files. Thanks.


If you use the WooCommerce plugin for your e-commerce pages, it has the capability to restrict products to certain countries. I’m not sure if it will block entire pages, but you could look into it. WooCommerce has a wide range of capabilities in terms of customization.

Thanks for the info WebMachine. Yes, we will be using WooCommerce for our “Buy Now” pages. I’ll look into the country-blocking features in WooCommerce.

I’m thinking it might be more work to “blacklist all non-US IPs” from seeing certain pages than it would be to “whitelist US Sates” in the ordering process.

Good point, might be better just to whitelist the countries I want.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.