On my wordpress blog, I have a number of directories and subdirectories. Rather then place an index.htm file in each directory, is there a global command that can be applied site wide to prevent people from viewing the contents of each of the various folders?
Yes, it's an easy fix if you're on an Apache server. Either create an .htaccess file or edit your current one (in your site's public root), and add the following to the beginning of the file: Options All -Indexes Code (markup):
Thank you, that worked great. Rather then give them a generic error message, can you redirect them to a custom error page?
Yes, you can use custom error pages. First create your error pages. Do a little research to find what the appropriate codes are, and which common errors you want to use. You're usually safe starting with 404 (Not Found) and 403 (Restricted). Then add the following to your .htaccess: ErrorDocument 403 /403.php ErrorDocument 404 /404.php Code (markup): Add a new line for each error code you are adding, and replace the 403.php and 404.php with the name of your corresponding page.