Forum Moderators: phranque
This Introduction to mod_rewrite [webmasterworld.com] post discusses some basic .htaccess techniques, and contains links to the Apache documentation and other resources.
Also, a site search on "blocking" or "block" and "domain", "remote host", or "IP address" here on WebmasterWorld will turn up dozens of threads on the subject.
Your two main options are to use Apache mod_access or mod_rewrite. While mod_rewrite is much more powerful, it is also much more complex, and some servers do not support it. You will have to test this, or ask your hosting provider if mod_rewrite is available to you.
HTH,
Jim