Only allow to view images from a folder with simple .htaccess file

Once in a while my beloved hackers upload their shitty files into image folder (basically they use some plugin for image upload). In most cases I will go and clean website. As additional measure to block future attempts, I tend to add small .htaccess file to tell webserver deny access to certain types of files.

First option

Just add the following code to .htaccess file and listed extensions will be restricted:

RewriteEngine On
RewriteRule \.(html|shtml|php|php3|inc)$ [NC,R=302,L]

and if visitor requests anything with extension html, shtml, php, php3, inc – he or she will be redirected to ?

Second option

with this example only listed extensions will be allowed:

RewriteEngine On
RewriteRule !\.(jpg|png|gif|jpeg)$ [NC,R=302,L]

Other good .htaccess examples: