Reputation: 578
hope you are dong fine.
I have have a subfolder in my public_html folder. In the subfolder, I have a .htaccess file with the following code:
# Disable indexing:
Options All -Indexes
# Ignore every file:
IndexIgnore *
# Prevent access to any file:
<FilesMatch "^.*$">
Order Allow,Deny
Deny from all
</FilesMatch>
Now when I browse to the subfolder, for example, www.mysite.com/subfolder/myfile.php, I shown my site's index.html page! Can this really be happening?!
Can someone please tell me what I need to do to show a generic "Access not allowed" page?
Thanks in advance for your help.
Upvotes: 0
Views: 63
Reputation: 578
This problem is solved. The problem was caused by another .htacess file in my public_html folder (which was created by Drupal) which is showing the index.html page.
Upvotes: 0
Reputation: 143966
Can someone please tell me what I need to do to show a generic "Access not allowed" page?
You simply need this inside the htaccess file in your directory that you want to deny access to:
Deny from All
that's it. No need to use other modules or anything special. This denies any access to this directory.
Upvotes: 0
Reputation: 7749
If you want to throw a Forbidden error for all access in a directory, you can add this to the htaccess in that directory (this require mod_rewrite to be enabled, wich most of the time is) :
RewriteEngine on
RewriteRule .* - [F]
Upvotes: 1