To close access from a specific IP address, add to the file.htaccess, located in the root folder of the site, the following lines:
Order Allow,Deny
Allow from all
Deny from 123.123.123.123
Deny from 122.122.122.122
where 123.123.123.123, 122.122.122.122 are IP addresses for which access to the site is prohibited.
Attention
Don't block your IP address by accident
To open access from a specific IP address, add to the file .htaccess the following lines:
Order Allow,Deny
Order Deny,Allow
Deny from all
Allow from xxx.xxx.xxx.xxx
Instead of xxx.xxx.xxx.xxx, specify the IP addresses for which you want to open access to the site.
If you need to block not individual IP addresses, but a subnet of IP addresses (a certain range), first determine the desired value using classless addressing CIDR (IP Range calculator in CIDR):
Then add to the file .htaccess, located in the root folder of the site, the following lines:
Order Deny,Allow
Deny from 123.123.0.0/26
where 123.123.0.0/26 is the IP subnet that you need to block.