: Is there a way to disable image hotlinking by 3rd-party sites while allowing Google Image Search Can I block other sites from hotlinking to images on my server to preserver bandwidth while still
Can I block other sites from hotlinking to images on my server to preserver bandwidth while still allowing my site to stay discoverable in Google and Bing image search?
More posts by @Hamaas447
1 Comments
Sorted by latest first Latest Oldest Best
I am assuming Apache and .htaccess.
From: perishablepress.com/creating-the-ultimate-htaccess-anti-hotlinking-strategy/
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} .(gif|jpe?g?|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+.)?domain. [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+.)?google. [NC]
RewriteCond %{HTTP_REFERER} !^http?://([^.]+.)?google. [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+.)?bing. [NC]
RewriteCond %{HTTP_REFERER} !^http?://([^.]+.)?bing. [NC]
RewriteRule .(gif|jpe?g?|png)$ - [F,NC,L]
You will need to change domain in the HTTP_REFERER line to your domain name of course. You may also want to change https to http as well. Also, you can add and or delete file extensions. They do not all have to be images.
This is a trusted site for .htaccess examples should you ever need one.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.