{"id":18794,"date":"2024-05-25T11:08:37","date_gmt":"2024-05-25T11:08:37","guid":{"rendered":"https:\/\/hostvento.com\/kb\/web-hosting\/how-to-block-country-traffic-in-cpanel\/"},"modified":"2024-06-16T16:53:25","modified_gmt":"2024-06-16T16:53:25","slug":"how-to-block-country-traffic-in-cpanel","status":"publish","type":"docs","link":"https:\/\/www.hostvento.com\/kb\/docs\/hosting-faqs\/how-to-block-country-traffic-in-cpanel\/","title":{"rendered":"How to Block Country Traffic in cPanel?"},"content":{"rendered":"\n<p>In order to prevent disputes or issues, you must block some people from seeing your website. Regular cPanel users can modify the htaccess file to prevent a country&#8217;s web traffic from reaching their server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">To Block Country Traffic<\/h2>\n\n\n\n<p>1. Log in to your&nbsp;<em>cPanel<\/em>&nbsp;account.<\/p>\n\n\n\n<p>2. Edit the&nbsp;<em>.htaccess<\/em>&nbsp;file via the&nbsp;<strong>File Manager<\/strong>&nbsp;tool.<\/p>\n\n\n\n<p>3. Enter this line at the end of the file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;IfModule mod_geoip.c&gt; \nRewriteEngine on RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$ \nRewriteRule ^(.*)$ \u2013 [F,L] \n&lt;\/IfModule&gt;<\/pre>\n\n\n\n<p>The given line has used the&nbsp;<strong>US<\/strong>, which is the country code for the United States of America. It will block all the web traffic from the country if you enter its country code here.<\/p>\n\n\n\n<p>You can refer to this link\u00a0ISO 3166-1 alpha-2\u00a0to find the country codes you are looking for.<\/p>\n\n\n\n<p>4. Click on&nbsp;<strong>Save Changes<\/strong>&nbsp;and&nbsp;<strong>Close<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.hostvento.com\/kb\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_block_country_traffic.png\" alt=\"\" class=\"wp-image-14131\"\/><\/figure>\n<\/div>\n\n\n<p>With it, the country traffic you choose to block will be screened by cPanel. It means the server will reject any access request from the country you blocked and return a&nbsp;<em>403 forbidden error<\/em>&nbsp;for the users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to prevent disputes or issues, you must block some people from seeing your website. Regular cPanel users can modify the htaccess file to prevent a country&#8217;s web traffic from reaching their server. To Block Country Traffic 1. Log in to your&nbsp;cPanel&nbsp;account. 2. Edit the&nbsp;.htaccess&nbsp;file via the&nbsp;File Manager&nbsp;tool. 3. Enter this line at the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":23377,"menu_order":1378,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-18794","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/18794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/comments?post=18794"}],"version-history":[{"count":1,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/18794\/revisions"}],"predecessor-version":[{"id":18798,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/18794\/revisions\/18798"}],"up":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/23377"}],"wp:attachment":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/media?parent=18794"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=18794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}