User account menu

  • Log in
BXTra.net

Breadcrumb

  • Home
  • Articles
  • [HOW-TO] Prevent Hotlink in Drupal 6 + Nginx - 2nd Method

[HOW-TO] Prevent Hotlink in Drupal 6 + Nginx - 2nd Method

By BXTra | 12:45 AM PST, Tue February 22, 2011
Nginx

After tried [HOW-TO] Prevent Hotlink in Drupal 6 + Nginx for a few days. I found a second method which is very similar to the first method but the different is in valid_referers.

Nginx Vhost configuration file - Protect hotlink (regexp)

valid_referers none blocked server_names 
     ~(domainname.com|google.|bing.);
if ($invalid_referer) { 	
     rewrite ^/files.*\.(gif|jpg|jpeg|png|bmp)$ http://www.domainname.com/nohotlink.gif last;
}

Above code, you allow domainname.com to hotlink your images. You also allow google with any top level domain like google.com, google.de, www.google.com, images.google.com, etc. to hotlink your images. Bing is also allowed here.

Source :
- http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/

About text formats
  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

  • Will the router get the Openvpn as a client option?
    6 years ago
  • cancellation
    6 years 1 month ago
  • Router ASUS RT-N12 D1 tomatoes passwort falsch
    7 years 8 months ago
  • WPS button = 30/30/30 hard reset button
    7 years 9 months ago
  • Save my day!
    8 years 3 months ago
  • How to
    8 years 6 months ago
  • Can i still access my modem (the one with the ISP provided)?
    8 years 6 months ago
  • A saving step!
    8 years 10 months ago
  • Problem with Asus n12e-c1
    9 years ago
  • don't use Hostgator
    9 years 2 months ago

© 2007 - 2023 BXTra.net. All Rights Reserved. 
Certain other content, photos and artwork displayed on BXTra.net are protected by copyright and are the property of their respective owners.

Privacy Policy