: Stop Apache serving filetypes Preferably using .htaccess files, though .conf files are an option, is there any way to stop Apache serving certain filetypes? For example, .db shouldn't be served
Preferably using .htaccess files, though .conf files are an option, is there any way to stop Apache serving certain filetypes?
For example, .db shouldn't be served for obvious reason (privacy and whatnot, etc.), so could I make them show as a 404 but still have them available for my CGI scripts?
Putting these sensitive files in a directory other than /public_HTML/ is also an option, though I like having them in the same directory as the scripts for ease of use.
Cheers
More posts by @Kimberly868
1 Comments
Sorted by latest first Latest Oldest Best
I would have said that placing these sensitive files above the document root would be preferable. And perhaps easier to manage if they are all contained in a particular directory, however...
Using .htaccess to prevent access to all .db and .exe files and return a 403 - Forbidden.
<Files ~ ".(db|exe)$">
Deny from all
</Files>
Unless you have a specific requirement, I would have thought a 403 would be better than a 404 in this instance, and this would seem more natural for Apache. To return a 404 here would require additional code.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.