user4812
user4812

Reputation: 6722

How do I stop visitors directly accessing the directories in my website?

I have a (Wordpress powered) website, and Google is indexing some of the sub-directories. How can I stop Apache from showing users the directory listing? I know I can edit .htaccess to password-protect a directory, but I would prefer a 403 / custom redirect if possible.

Upvotes: 3

Views: 472

Answers (3)

Ateş Göral
Ateş Göral

Reputation: 140060

You need this entry in your .htaccess file:

Options -Indexes

Upvotes: 12

Flory
Flory

Reputation: 2849

Don't know much about Apache but you should do a 404 instead of a 403 if you can because a 403 tells someone that they may have found something interesting.

Upvotes: -2

warren
warren

Reputation: 33455

Look at your robots.txt rules, and make sure apache is not serving-up directory listings.

see http://httpd.apache.org/docs/2.0/howto/htaccess.html && http://www.webmasterworld.com/forum92/5272.htm

Upvotes: 3

Related Questions