You can block traffic from any specific IP address with the .htaccess file by following the steps listed below –
1. Log in to your cPanel account and open the File Manager.
2. Open the public_html directory.
3. Click on Setting, tick the Show Hidden Files (dotfiles) option, and then click Save.
4. Right-click on the .htaccess file and click on the Edit option.
5. Insert the following lines in the .htaccess file as shown in the screen capture, and save the file.
Order Deny, Allow
Deny from 192.xxx.xxx.xxx
Note
Replace the IP 192.xxx.xxx.xxx with the actual IP Address you want to block for your website.