phranque - 5:15 am on May 14, 2013 (gmt 0)
regarding the HostNameLookups directive it would be easiest to do this in your server config file using a <Directory> container.
it's possible in .htaccess but only by using a <Files> container which means you need to put the .htaccess file containing this IN the directory in question.
however i think the HostNameLookups directive only affects hostname logging.
i think what you really need is Apache Module mod_authz_host:
this module uses the Require directive and if you do something like Require host example.com it "will cause Apache to perform a double reverse DNS lookup on the client IP address, regardless of the setting of the HostnameLookups directive."
this is expensive in terms of latency so only do this where required.
therefore you'll probably still want/need to configure this in a similar context/container as i described above.