Skip to content

How to Prevent hotlinking?

Here i will show you how to prevent hot linking of images and other file types.This can greatly impact bandwidth usage.

By using htaccess we can block linking directly to non-html objects on other servers from your server, such as images, movie files etc.

create .htaccess file in your root.

RewriteEngine on
# Allow blank referrers
RewriteCond %{HTTP_REFERER} !^$
# Sites allowed to link your images.
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain2.com [NC]
# File format to block and if image hotlinking is detected, this image will show up.
RewriteRule \.(jpg|jpeg|png|gif)$ https://arjunphp.com/wp-content/themes/arjun/images/arjun_php_developer_blog.png [NC,R,L]
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments