In order for .htaccess to work you must be using an Apache web server. Apache also has to be configured to allow .htaccess files to override directives.
http://httpd.apache.org/docs/configuring.html#htaccess
Otherwise, one possibility I'd suggest is that you store that information in a database instead of in the file system.
As text files you could also convert these files into PHP scripts, if they are plain text files. You can store information in variables (but don't output anything), then when someone tries to access the file directly all it does is output a blank page. Does that make sense? Of course for file formats that aren't plain text, you won't be able to take that approach.
Another possibility is storing the files in directories outside of www accessible directories, then you can call on PHP to output the file where you need a user to have access to it. Remember, PHP is a programming language, it is capable of accessing files, reading their contents and emulating them. If your files aren't plain text, this is probably the most secure approach.
If I had more information about the types of files you're trying to protect, I can provide you with some more specific examples.
HTH!
Regards,
Rich
--
[
http://www.smilingsouls.net]
[
http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail