I have been reading up on analytics spam and have been looking for a way of dealing with it across multiple wordpress sites I run. The best solution seems to be to block the hostname via my htaccess file. The issue is I would need to set this up manually across all sites, making initial setup time-consuming and ongoing maintenance a nightmare!
My question is this: can I include this information within a plugin or theme file - i.e. create a plugin that alters the htaccess file to filter out from a master list of hostnames?
I am aware there are a few plugins out there that offer htacces edits, but I would like to create my own as I'll only be using it on a very select set of sites.