block country from viewing website

Fouad

Member
Sep 16, 2021
7
0
1
Egypt
cPanel Access Level
Root Administrator
Hi,
I have many accounts in my WHM, one of them has a large amount of fake registration from a specific country, when I add Recaptcha on this website I found the same requests sent but without registration!
I need to block a whole country from viewing the website, not all sites in my WHM but in this specific website, how can I accomplish that?
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
1,041
111
118
Houston, TX
cPanel Access Level
Root Administrator
Hello! While this would technically be possible via the .htaccess file, it wouldn't be recommended since you would end up blocking many IP ranges. It might be possible to do this via CloudFlare. This article might help.

CloudFlare Country Block

It also might be possible via Apache's mod remote_IP. However, you would need to confer with a sysadmin on this since it wouldn't be supported by cPanel.

mod remote_IP