I am using WordPress multisite (3.3.1) and am trying to protect uploads from certain blogs from being hotlinked and directly accessed. This is loosely related to How to Protect Uploads, if User is not Logged In?How to Protect Uploads, if User is not Logged In?, but I only want the uploads to be accessible through scripts running on the server (IE. the server alone can display/serve uploads), so the content can be protected by WordPress user-rights.
For example, I have a filed called 40c.jpg located at localhost/files/2011/07/40c.jpg; I want the file to show up only when called by HTML on the local domain (here: localhost). So not on any other site on the WordPress Network, any other domain or when accessed directly (IE. visiting localhost/files/2011/07/40c.jpg).
Preferably, this would be done by using WP_Rewrite within functions.php of the theme for this site; as that would easily limit the impact to just that site. But using the .htaccess in WordPress root also is a viable option, though I assume that would mean that the domain itself would have to be specified there (IE. localhost).
Any suggestions on how to accomplish this? I've had very little luck through searching StackExchange, WordPress.org and Google.