{"id":29933,"date":"2022-09-02T03:33:12","date_gmt":"2022-09-02T03:33:12","guid":{"rendered":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/"},"modified":"2026-01-14T23:45:06","modified_gmt":"2026-01-14T23:45:06","slug":"how-to-block-a-countrys-ip-range","status":"publish","type":"knowledgebase","link":"https:\/\/www.wpstaq.com\/nz\/knowledgebase\/how-to-block-a-countrys-ip-range\/","title":{"rendered":"How to block a country in the firewall"},"content":{"rendered":"<p>For security, compliance, or operational reasons, you may wish to block visitors from certain countries from accessing your WordPress site. With Staq Firewall, blocking access by country is quick and easy using geo IP rules.<\/p>\n<h2>Step-by-Step: Blocking Countries via Staq Firewall<\/h2>\n<ol>\n<li>Log in to the WordPress site hosted on Staq.<\/li>\n<li>In the left menu, click <strong>Staq Hosting<\/strong>.<\/li>\n<li>Click <strong>Firewall<\/strong>.<\/li>\n<li>Click the <strong>Ban Rules<\/strong> tab.<\/li>\n<li>Click <strong>Create New Rule<\/strong>.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2022\/09\/ban-rules-firewall-1024x537.png\" alt=\"Create New Ban Rule\" width=\"1024\" height=\"537\" \/><\/p>\n<h3>Select Country Blocking Rule Type<\/h3>\n<ol>\n<li>Under <strong>Rule Type<\/strong>, select <strong>Country Blocking<\/strong>.<\/li>\n<li>Choose the countries you want to block.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2022\/09\/ban-rule-type-1024x787.png\" alt=\"Country Blocking Rule Type\" width=\"1024\" height=\"787\" \/><\/p>\n<h3>Choose a Blocking Condition<\/h3>\n<p>If you want to block the countries you selected, choose:<\/p>\n<ul>\n<li><strong>Ban IP addresses from the selected countries (inclusion)<\/strong><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2026\/01\/ban-selected-country.png\" alt=\"Inclusion Condition\" width=\"663\" height=\"282\" \/><\/p>\n<p>If instead you want to block all countries except a few selected ones, e.g., only allow traffic from Australia, then select Australia from the Countries list and then choose the condition as:<\/p>\n<ul>\n<li><strong>Ban IP addresses from the unselected countries (exclusion)<\/strong><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-38518\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2026\/01\/ban-unselected-country-3.png\" alt=\"\" width=\"595\" height=\"266\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Exemption Check<\/h3>\n<p>Enabling this setting allows safe, verified bots (like Googlebot, Bing, Meta, OpenAI, etc.) to bypass your country block \u2014 even if their IP address comes from a restricted country:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2026\/01\/exemption-check.png\" alt=\"Exemption Check\" width=\"665\" height=\"185\" \/><\/p>\n<h3>Script Blocking Mode<\/h3>\n<p>If set to <strong>Yes<\/strong>, banned users will be silently blocked at the Nginx level without seeing an error or CAPTCHA. This reduces server load, but may lead to false positives.<\/p>\n<p>If set to <strong>No<\/strong>, blocked users will see a reCAPTCHA page and can request access by verifying themselves \u2014 a safer option if you&#8217;re unsure.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2026\/01\/strict-block.png\" alt=\"Script Blocking Mode\" width=\"657\" height=\"149\" \/><\/p>\n<h2>Final Step<\/h2>\n<p>Once you&#8217;re done configuring the rule, click <strong>Save Rule<\/strong> to activate it.<\/p>\n","protected":false},"featured_media":29657,"parent":0,"template":"","class_list":["post-29933","knowledgebase","type-knowledgebase","status-publish","has-post-thumbnail","hentry","categories-security-firewall"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to block a country in the firewall - Managed Hosting Platform for WordPress<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to block a country in the firewall - Managed Hosting Platform for WordPress\" \/>\n<meta property=\"og:description\" content=\"For security, compliance, or operational reasons, you may wish to block visitors from certain countries from accessing your WordPress site. With Staq Firewall, blocking access by country is quick and easy using geo IP rules. Step-by-Step: Blocking Countries via Staq Firewall Log in to the WordPress site hosted on Staq. In the left menu, click&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/\" \/>\n<meta property=\"og:site_name\" content=\"Managed Hosting Platform for WordPress\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/staqhosting\/\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-14T23:45:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/security-firewall.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"501\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/\",\"name\":\"How to block a country in the firewall - Managed Hosting Platform for WordPress\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/security-firewall.jpg\",\"datePublished\":\"2022-09-02T03:33:12+00:00\",\"dateModified\":\"2026-01-14T23:45:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/#breadcrumb\"},\"inLanguage\":\"en-nz\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-nz\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/security-firewall.jpg\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/security-firewall.jpg\",\"width\":1000,\"height\":501},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/how-to-block-a-countrys-ip-range\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.wpstaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to block a country in the firewall\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"name\":\"Managed Hosting Platform for WordPress\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wpstaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-nz\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\",\"name\":\"Staq\",\"alternateName\":\"WPStaq\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-nz\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"width\":512,\"height\":512,\"caption\":\"Staq\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/staqhosting\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpstaq\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to block a country in the firewall - Managed Hosting Platform for WordPress","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/","og_locale":"en_US","og_type":"article","og_title":"How to block a country in the firewall - Managed Hosting Platform for WordPress","og_description":"For security, compliance, or operational reasons, you may wish to block visitors from certain countries from accessing your WordPress site. With Staq Firewall, blocking access by country is quick and easy using geo IP rules. Step-by-Step: Blocking Countries via Staq Firewall Log in to the WordPress site hosted on Staq. In the left menu, click&hellip;","og_url":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/","og_site_name":"Managed Hosting Platform for WordPress","article_publisher":"https:\/\/www.facebook.com\/staqhosting\/","article_modified_time":"2026-01-14T23:45:06+00:00","og_image":[{"width":1000,"height":501,"url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/security-firewall.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/","url":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/","name":"How to block a country in the firewall - Managed Hosting Platform for WordPress","isPartOf":{"@id":"https:\/\/www.wpstaq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/#primaryimage"},"image":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/security-firewall.jpg","datePublished":"2022-09-02T03:33:12+00:00","dateModified":"2026-01-14T23:45:06+00:00","breadcrumb":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/#breadcrumb"},"inLanguage":"en-nz","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/"]}]},{"@type":"ImageObject","inLanguage":"en-nz","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/#primaryimage","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/security-firewall.jpg","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/security-firewall.jpg","width":1000,"height":501},{"@type":"BreadcrumbList","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/how-to-block-a-countrys-ip-range\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.wpstaq.com\/"},{"@type":"ListItem","position":2,"name":"How to block a country in the firewall"}]},{"@type":"WebSite","@id":"https:\/\/www.wpstaq.com\/#website","url":"https:\/\/www.wpstaq.com\/","name":"Managed Hosting Platform for WordPress","description":"","publisher":{"@id":"https:\/\/www.wpstaq.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wpstaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-nz"},{"@type":"Organization","@id":"https:\/\/www.wpstaq.com\/#organization","name":"Staq","alternateName":"WPStaq","url":"https:\/\/www.wpstaq.com\/","logo":{"@type":"ImageObject","inLanguage":"en-nz","@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","width":512,"height":512,"caption":"Staq"},"image":{"@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/staqhosting\/","https:\/\/www.linkedin.com\/company\/wpstaq"]}]}},"_links":{"self":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/knowledgebase\/29933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/types\/knowledgebase"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/media\/29657"}],"wp:attachment":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/media?parent=29933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}