From 05ce22b9ca504f22b7d1081ede62c802df2feb6e Mon Sep 17 00:00:00 2001 From: Denis Verbin Date: Sun, 15 Feb 2015 21:10:15 +0200 Subject: [PATCH] Disable Image Hotlinking for fixed domains --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e7806b6..c8bef7e 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ What I'm doing here is mostly collecting useful snippets from all over the inter - [Deny Access to Backup and Source Files](#deny-access-to-backup-and-source-files) - [Disable Directory Browsing](#disable-directory-browsing) - [Disable Image Hotlinking](#disable-image-hotlinking) + - [Disable Image Hotlinking for Fixed Domains](#disable-image-hotlinking-for-fixed-domains) - [Password Protect a Directory](#password-protect-a-directory) - [Password Protect a File or Several Files](#password-protect-a-file-or-several-files) - [Performance](#performance) @@ -220,7 +221,15 @@ RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] ``` -If you want block 'blank' referers too - delete `RewriteCond %{HTTP_REFERER} !^$` line. +If you want block 'blank' referers too - delete `RewriteCond %{HTTP_REFERER} !^$` line (not recommended). + +### Disable Image Hotlinking for fixed domains +This settings disabling image hotlinking for fixed sites only. +``` apacheconf +RewriteEngine on +RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?badsite.com.*$ +RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] +``` ### Password Protect a Directory First you need to create a `.htpasswd` file somewhere in the system: