hotlink protection with rewrite

tophi nginx-forum at
Sun Jul 17 13:32:50 UTC 2011

So not I'm not able to direct download the file, but videos also can not
be started from the website's player. I have changed *; also
with and, same result

Try this:

location ~ \.(swf|mp4)$ {
valid_referers server_names blocked *;
if ($invalid_referer) {
rewrite ^(.*)$ /hl.png break;

location =/hl.png {
root /home/tophi/www/images;

2011/7/16 tophi <nginx-forum at>

Posted at Nginx Forum:,39501,212485#msg-212485

More information about the nginx mailing list