Sooner or later you’re going to have a bot relentlessly pinging your site and posting comments that link to undesirable sites. Fortunately, stopping these tpyes from accessing the site is easy.
1) If it’s not already there, create a file named .htaccess in the root directory of your blog.
2) Add the following text:
order allow,deny deny from 18.104.22.168 deny from 22.214.171.124 allow from all
3) As you receive new spam posts, add a new line to this file containing the offender’s ip address.