Last active
December 30, 2017 21:00
-
-
Save chtzvt/01ba4d64730f76f2ec08 to your computer and use it in GitHub Desktop.
This bit of lighttpd configuration is what I use to stop image hotlinking, while also ensuring that search engines and social media can still access images.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Hotlinking madness :^) | |
$HTTP["host"] =~ "charltontrezevant\.com" { | |
$HTTP["referer"] !~ "charltontrezevant|ctis\.me|google|bing|facebook|twitter|reddit|ycombinator|Skype|Slack" { | |
$HTTP["useragent"] !~ "Google|msnbot|FlipBoard|Bing|Yahoo|Facebook|Yandex|twitter|Slack|Skype" { | |
$HTTP["url"] =~ "\.jpeg|\.jpg|\.png|\.gif|\.bmp" { | |
$HTTP["url"] !~ "hotlinking\.png" { | |
url.redirect = ("" => "https://www.charltontrezevant.com/resources/images/hotlinking.png") | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment