Quantcast
Channel: W3lessons.info » htaccess | W3lessons.info
Viewing all articles
Browse latest Browse all 6

Prevent hotlinking using .htaccess

$
0
0

Bandwidth theft or “hotlinking” is direct linking to a web site’s files (images, video, etc.)

Hotlinking (the act of using images from another site than yours) is unfortunely a common practice which can waste lots of your precious bandwidth. This useful snippets will redirect all hotlinked images to a specific image, defined on line 6.

RewriteEngine On
#Replace ?mysite.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+.)?mysite.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]

Viewing all articles
Browse latest Browse all 6

Trending Articles