Hi, I got 2 questions: 1. How do I prevent visitors from indexing a site. For example when they visit: http://www.mysite.com/pictures/ Code (markup): How do I prevent them from seeing all the files in this folder? I think it has to do something with .htaccess, but I am not sure. 2. How to apply a 403 or a 401 error to a file or folder? Thanks in advance.
You can create a file called index.html and save it there. Then they'll see this instead of the index.
easiest way to stop directory browsing is to just put a file with the default name in it (index.html if you are using apache)
But I will they see the main page? Won't they be redirected to index.html every time they visit www.mysite.com?
The index.html file only affects the folder where it's saved in. If you save it in "pictures", then your main page will remain the same. It'll only do what I said above: If you navigate to the directory, you'll just see the index.html file instead of the directory index. That's what you want, right? Index.html can be just a blank page...
Add this to your htaccess file: Options -Indexes Code (markup): Will give a 403 error instead of listing contents.
i use the index.html trick....i even put a small message on it too "Can't View the Directory...Please dont try"