How to deny website access for certain IP addresses?

Add the following lines to the .htaccess file located in the root directory of your website:

Order Allow,Deny
Allow from all
Deny from 123.123.123.123
Deny from 122.122.122.122

Here, 123.123.123.123, 122.122.122.122 are IP addresses with denied website access.

Warning

Make sure not to block your IP address by accident. You can learn your IP address here: Learn more about blocking.