Could you give me the rewrite rule for both apache and nginx that forbidden unauthorized access or reference to original images by third party website , reference to thumbnails are allowed.
Following are rewrite rule I wrote it myself but seems not working, and I don't know how to write it for nginx.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(image|images)
RewriteRule ^.*$ - [L]
RewriteBase /
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !mydomain.com [NC]
RewriteCond %{HTTP_REFERER} !google.com [NC]
RewriteCond %{HTTP_REFERER} !baidu.com [NC]
RewriteCond %{HTTP_REFERER} !yahoo.com [NC]
RewriteCond %{REQUEST_FILENAME} !\.th\.(gif|jpe?g|png|bmp)$ [NC]
RewriteRule .(gif|jpe?g|png|bmp) image/replace.jpg [R,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule images/.+\.(gif|jpe?g|png|bmp) image/404.gif [NC,L]
Following are rewrite rule I wrote it myself but seems not working, and I don't know how to write it for nginx.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(image|images)
RewriteRule ^.*$ - [L]
RewriteBase /
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !mydomain.com [NC]
RewriteCond %{HTTP_REFERER} !google.com [NC]
RewriteCond %{HTTP_REFERER} !baidu.com [NC]
RewriteCond %{HTTP_REFERER} !yahoo.com [NC]
RewriteCond %{REQUEST_FILENAME} !\.th\.(gif|jpe?g|png|bmp)$ [NC]
RewriteRule .(gif|jpe?g|png|bmp) image/replace.jpg [R,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule images/.+\.(gif|jpe?g|png|bmp) image/404.gif [NC,L]
Last edited: