How to Disable Image Hotlinking in WordPress

in WordPress5 months ago

Image Credit-:WikiMedia Commons

On WordPress Platform performance of hosting server matters a lot because if your website failed to load within 3 second then it does not matter how beautiful your website is and its valuable content user will go to other website. There are many factor that can affect loading time of a WordPress website one of them is image Hotlinking.

When someone link your website images to their website is known as image Hotlinking. In these images linked on other website will load from your server and it will consume your server resources and will affect your website loading time.

To disable Hotlinking of images in WordPress paste below code in your WordPress .htaccess file.

# disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourwebsite.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

Never forget to replace yourwebsite.com with your website URL. In above code you’re allowing Google only and your own website. If someone still link your images then image will appear in broken form.

If you like my work, Please Upvote, Follow, Reblog and Comment. You may also continue reading my recent posts which might interest you:

Follow Me: @amar-patel

5k2tWE6P7gjtWGNDHKvBHJvQxLmF4oqu4kETT3mP.gif