Enable Hotlink Protection in .htaccess for LSWS

A hotlink occurs when someone embeds content from your site into another site and uses your bandwidth to serve the files.

On cPanel, there is a hotlink protection feature you can enable for Apache. Navigate to Home > Security > Hotlink Protection and enable or disable it.

This may not work for LiteSpeed Web Server. To enable hotlink protection on LSWS, you can add the following rewrite rules to the .htaccess of the relevant domains. be sure to replace YOURDOMAIN with your own domain:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?YOURDOMAIN.com/.*$ [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]
  • Admin
  • Last modified: 2018/09/19 20:51
  • by Lisa Clarke