search ]

Prevent Image Hotlinking via HTACCESS

Tired of people using your bandwidth by linking to your images on their sites? This annoying phenomenon is called hotlinking. Prevent image hotlinking by adding the following code at the bottom of your .htaccess file and replace the domain name with yours:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?example.com/.*$ [NC] 
RewriteRule .(gif|jpg)$ http://www.example.com/hotlink.gif [R,L]

For more security tips, see Hardening WordPress Security.

Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo