Disable directory listings with 404 instead of 403

I've disabled directory listings like so...

Options -Indexes

When I try and access a directory like this:-

www.example.com/secret/

I get a 403 Forbidden response.

However, I want a 404 Not Found response, so hackers can't guess my directory structure so easily. How would I do that?


Enable mod_rewrite and AllowOverride in /secret. Then create .htaccess:

RewriteEngine On
RewriteBase   /secret
RewriteRule   ^$ - [R=404,L]

I've looked around the internet for an answer to a similar problem. While mod_rewrite is a possible solution, I find the best solution uses the "RedirectMatch" directive.

See StackOverflow: Problem redirecting 403 Forbidden to 404 Not Found