Wills - Loans - Debt Consolidation Loans - Credit Card Consolidation - Remortgages

PDA

View Full Version : Preventing browsing of folders


bluemanteam
Jan 2nd 2008, 1:16 am
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?

WebGeek182
Jan 2nd 2008, 1:34 am
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

bluemanteam
Jan 2nd 2008, 5:43 pm
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

Thank you, that worked great.

Rather then give them a generic error message, can you redirect them to a custom error page?

venam
Jan 15th 2008, 2:17 am
i am interested to! how do i redirect them on a custom error page or on the main site?

WebGeek182
Jan 18th 2008, 5:56 am
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

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.