Problem with Hotlink Protection

dullnicker nginx-forum at
Wed Sep 14 16:22:30 UTC 2011

Dear Francis,

thank you very much indeed for taking the time to help me out. It seems
that - with your help - I made it! :-)
I inserted the "invalid_referrer" check within the "location ~* \.php$"
block like you suggested and it works like a charm now!

It looks like this:
<-- SNIP -->
location ~ \.php(.*)$ {
    valid_referers server_names;
    if ($invalid_referer) {
    return   403;

   include fastcgi_params;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  try_files $uri =404;
    error_page 404 /404page.html; #makes nginx return it's default 404
#	page instead of a blank page



Again, thank you for your fantastic help!

Kind regards

Posted at Nginx Forum:,215198,215207#msg-215207

More information about the nginx mailing list