Privacy invaders, Hackers, Competitors and others attack your site to lower your rank or try to cause inconvenience, so your business does not do well.
First, we are going to show you, how you can access the cPanel and reach the .htaccess file.
Step 1: Login to the cPanel by adding (domain.com/cpanel) and then hit enter. If you have forgotten the credentials, then open the email client associated with the YouStable account because we send a copy of credentials to the registered email as well.
Step 2: In the search bar, type “file manager” and select the first result.
Step 3: Double click on the “public_html” and then it will take you one-step closer to completing the process.
Step 4: cPanel hides the file, so you have to click on the “settings” located on the same page at the top, and a pop-up appears on your screen. Click on “show hidden files” and then click on “save” to complete the process.
Step 5: Now, select the .htaccess file, and right-mouse click to view more options, and click on “edit” it.
Step 6: The confirmation pop-up shows up, and click on “edit” to proceed.
Step 7: The .htaccess file is now editable.
Step 8: Go to the IPDENY site to copy the IP address of specific country, and click on “download zone file” to download a text file, or you can click on “aggregated zone file” to view the IP address in another window.
Step 9: Okay, now you have to follow the order from the codes below.
deny deny from http://220.127.116.11/22
deny from http://18.104.22.168/19
allow from all)
The “Deny” will block the block IP address that you don’t want the traffic to come from it. Rest of the countries can view your site normally, but the mentioned IP address is blocked.
order allow, deny deny from http://22.214.171.124/22 deny from http://126.96.36.199/19 allow from all
Now, if you want to allow specified traffic from selected countries, then you can use the below codes.
order deny, allow deny from all allow from 188.8.131.52
The “allow from IP address” will allow the specific country only, while rest of the world is blocked to access the site.