Monday, May 14, 2012

.htaccess prevent hotlinking

If you have problems with other websites stealing your bandwidth, and you want to prevent hotlinking, use following snippet and place code in your htaccess file:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mywebsiteurl\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|gif|bmp|png)$ http://hotlnk.mywebsiteurl.com/hotlnkingisnotallowed.jpg [L]

No comments:

Post a Comment