I am using nginx as a reverse proxy with apache.
I have added this code to prevent hotlinking, and it is working fine so far.
#hotlinking protection
location ~* \.(png|gif|jpg|jpeg)$ {
valid_referers none blocked mydomain.com *.mydomain.com;
if ($invalid_referer){
return 403;
}
}
How can I make it so when somebody tries to hotlink an image, instead of a 403 error, he will get a specific anti-hotlinking image?
I tried
return 301 h++p://i.imgur.com/mypicturename.png;
but it didnt work.
I don't know very much about nginx yet, every help will be very appreciated!
h++p
instead ofhttp
?