Here we will show how easy it is to block an IP address such the need arrise. First part is to allow all user but listed IPs, second part is to block all IP address but allow selected IP address.
Block only selected IP addresses
order allow,deny deny from 18.104.22.168 deny from 012.34.56.78 allow from all
To deny more IP addresses simply repeat line 2 or 3 “deny from 22.214.171.124
Block all IP address but allow only selected IPs
Order deny,allow Deny from all Allow from 126.96.36.199
More information can be found the the Apache.org website under Access Control using HTACCESS