Mobile app version of vmapp.org
Login or Join
Kimberly868

: 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

@Kimberly868

Posted in: #Apache #Htaccess #HttpdConf #Webserver

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kimberly868

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme