Skip to content

How to block countries easily in Hostinger for WordPress website

Hostinger has a built-in tool that sits above your WordPress plugins, meaning you can block countries without breaking your site speed or worrying about cache conflicts.

Here is the step-by-step fix for Hostinger users:

Option 1: The “Hostinger CDN” Method (Easiest)

If you are on a “Business” or “Cloud” hosting plan, Hostinger gives you a built-in CDN that handles this for you.

  1. Log in to your Hostinger hPanel.
  2. Go to Websites and click Manage next to your site.
  3. In the sidebar, search for CDN (or look under the “Performance” section).
  4. If it is not active, click Enable.
  5. Once enabled, look for the “Traffic Blocking” or “Block Visitors” section.
  6. Select Block by Country.
  7. Add the countries you want to ban.

Why this works: Hostinger checks the visitor’s location before they even touch your WordPress installation. The blocked user never gets to your cache, so the “snapshot” problem never happens.


Option 2: The Cloudflare Integration (Free & Best)

If you don’t see the Hostinger CDN option (or are on a different plan), Hostinger has a one-click integration for Cloudflare, which is the industry standard for this.

  1. In your hPanel, go to Websites > Manage.
  2. Search for Cloudflare in the sidebar.
  3. Follow the prompts to connect your domain (it is usually a few clicks).
  4. Once connected, log in to your account at Cloudflare.com.
  5. Go to Security > WAF (Web Application Firewall).
  6. Create a rule: If Country equals [X], then Block.

Option 3: The .htaccess Method (Manual Fallback)

If you absolutely cannot use the options above, you can block countries at the server level using a file called .htaccess. This works even with page caching enabled because the server checks this file before loading the cache.

  1. Go to hPanel > Files > File Manager.
  2. Open the public_html folder.
  3. Find the file named .htaccess (right-click to edit).
  4. You will need to paste a list of “Deny” rules for the specific country IPs.
    • Note: I do not recommend this unless necessary, as you have to manually update the list of IPs every month, otherwise the block stops working.

My Recommendation: Check Option 1 first. If you see “CDN” in your Hostinger dashboard, that is a 2-minute fix that solves your problem permanently.

See also  Generate Images and Videos at Low Cost with Vertex AI

Leave a Reply

error: Content is protected !!