How To Restrict Access To Media Uploads Using .htaccess

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:

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.