Skip to content

Instantly share code, notes, and snippets.

@evemilano
Created January 27, 2015 13:24
Show Gist options
  • Save evemilano/16f0df40bdc8905aaa9e to your computer and use it in GitHub Desktop.
Save evemilano/16f0df40bdc8905aaa9e to your computer and use it in GitHub Desktop.
Bloccare hotlinking su server Nginx - ADV
# è possibile definire una cartella da bloccare
# location = /immagini/vietato_rubare.png
# oppure i tipi di file
location ~ \.(gif|png|jpg|jpeg|JPG|GIF|JPEG|PNG)$ {
valid_referers none blocked ilmiosito.com *.ilmiosito.com;
if ($invalid_referer) {
rewrite \.(gif|png|jpg|jpeg|JPG|GIF|JPEG|PNG)$ http://www.ilmiosito.com/immagini/vietato_rubare.PENG redirect;
# alternativa
# rewrite ^(.*)$ http://ilmiosito.com/immagini/vietato_rubare.png last;
}
}
@evemilano
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment