How to block unwanted web traffic by country
Sometimes, it is necessary to prevent specific visitors from accessing your website to avoid any conflicts or complications.
Our cPanel users can block the web traffic of a country on their hosting by editing the htaccess file.
How To Edit A .htaccess File Through The cPanel File Manager?
To Block Country Traffic
1. Log in to your cPanel account.
2. Edit the .htaccess file via the File Manager tool.
3. Enter this line at the end of the file:
The given line has used the US, which is the country code for the United States of America.
You can refer to this link to find the country codes you are looking for.
4. Click on Save Changes and Close.
Result
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 403 forbidden error for the user.
Need help? Get in touch.