Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

how to block Country’s IP Addresses

How to block Country’s IP Addresses

How to block Country’s IP Addresses : Fortunately, there is a method to block or allow visitors from specific countries by utilizing the .htaccess file in WordPress. In this tutorial, we will explore how to accomplish this.

Step 1: Obtain the IP Addresses of the Country Numerous online tools are available to facilitate the blocking

or allowing of visitors based on their country. For this guide, we will use Country IP Blocks.

1 -Visit the Country IP Blocks homepage. Choose the countries you wish to block or allow.

create-acl

Under the Select Format section, select either Apache .htaccess Deny or Apache .htaccess Allow,

depending on whether you want to block or allow visitors from those countries.

Click on Create ACL. The ACL results will be displayed on the right side of the screen. Use the Copy ACL to Clipboard button to copy the generated ACL.

If you are using the allow function, ensure that you include the line “deny from all” above the list of allowed IPs.

allow-or-block-countries

 

Generated IP Addresses

Step 2: Add the Generated IP Addresses to the .htaccess File Finally, paste the IP addresses of the countries you wish to block or allow into the .htaccess file.

Go to Files -> File Manager. Select your domain and click on Go To File Manager.

Navigate to the public_html folder and open the .htaccess file. Paste the ACL into the .htaccess file and click on Save & Close.

Your .htaccess file will resemble the following: Conclusion In this tutorial, you have learned a simple method to block or allow visitors from specific countries.

By generating the country’s IP addresses using Country IP Blocks and adding an access control list (ACL) to your .htaccess file, you can control access to your website.

How to block Country’s IP Addresses
How to block Country’s IP Addresses

We hope you found this guide helpful. Feel free to ask any questions in the comments section please feel free to check our services .

Thank you for Contacting Lenawa Solutions , Please let us know in what we may assist you today :)

22:33