In this tutorials, I’ll tell you how you can restrict access to media upload formats in your website by using .htaccess file. This trick would allow you to upload your personal files to your hosting and some formats will be restricted from your website, and can only be viewed or downloaded from the file manager/ftp of your hosting.
Add following to your .htaccess file:
# restrict access to uploads directory <Files ~ ".*\..*"> Order Allow,Deny Deny from all </Files> <FilesMatch "\.(jpg|jpeg|jpe|gif|png|tif|tiff)$"> Order Deny,Allow Allow from all </FilesMatch>
Only the formats specified in the sixth will be not be restricted. You can add as many formats as you want to sixth line of the code.