Prevent hot linking of images from .htaccess or cPanel
Some website users directly link to your website Images and steals the bandwidth of your website. You can avoid hot linking by two ways. From cPanel or via .htaccess file directly.
1. Prevent from cPanel (x2 theme).
Login to cPanel. You will find hotlink protection icon from where you can enable hot link protection.
2. Prevent from .htaccess file.
You can directly place below code in your .htaccess file to disable hot linking:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourdomain.com(/)?.*$ [NC]
RewriteRule .*.(gif|jpg|jpeg|bmp|wmv)$ http://www.yourdomain.com/image.jpg [R,NC]
Note: replace yourdomain.com with your domain name.
Thanks!
Sign up or log in