Prevent hotlinking

Max maxbear at
Sun Apr 12 19:45:01 MSD 2009

Hello all,

I tried to use the following code to prevent hotlinking. But it blockes
myself as well, anyone got any idea?

location ~* (\.jpg|\.png|\.css)$ {
    valid_referers blocked *;
if ($invalid_referer) {
return 404;


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list