[apache] Deny access to files with specific extensions



Deny access to files with specific extensions

Want to configure Apache web-server to deny user trying to get a file with specific extension like mp3, avi, flv, doc, pdf, txt or other?


For this use the Files directive either in .htaccess or in your httpd.conf file:

<Files ~ "\.(mp3|avi|flv|doc|pdf|txt)$">
	Deny from all
</Files>