huy Posted June 26, 2014 Share Posted June 26, 2014 Hi, Anybody know how to config nginx.conf to prevent hot linking or leeching of images not using mod_rewrite ? Please share your code of links, Thank you Quote Link to comment Share on other sites More sharing options...
DragonVoid Posted June 26, 2014 Share Posted June 26, 2014 Try to do it with Apache.. Make sure Apache mod_rewrite is enabled. Even though you said without using it.. Open the .htaccess and put this code anywhere.. RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^your website name here.*$ [NC] RewriteRule ^.*.(bmp|tif|gif|jpg|jpeg|jpe|png)$ - [F] Quote Link to comment Share on other sites More sharing options...
allan.exe Posted June 27, 2014 Share Posted June 27, 2014 htaccess for nginx # nginx configuration location / { if ($http_referer !~ "^$"){ return 403; } } Quote Link to comment Share on other sites More sharing options...
Lock Down Posted July 5, 2014 Share Posted July 5, 2014 Add this to the conf file. location ~ .(jpe?g|png|gif)$ { valid_referers none blocked mysite.com *.mysite.com; if ($invalid_referer) { return 403; } } Of course change it to your site from mysite.com .. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.