I enabled watermark funtion of Magento, but original files still accessable from url without watermark.


Cached image url with watermark


Original image url without watermark:


So, if someone remove /cache/df484df48ez74849c15sd4f7780/ from url can access to original photo without watermark to steal images.

How can i protect my original images?


I would suggest the only way to guarantee the images are permanently watermarked is to edit them before uploading them to your site.

I appreciate this is time consuming thought.


very good solution: How To Protect Original Product Images In Magento 2?

The simple solution here is modifying and using the following .htaccess file in the /pub/media/catalog directory:

 Options +FollowSymLinks
RewriteEngine on

#The next coding line permits the original images to be accessed by admin end directly

RewriteCond %{HTTP_REFERER} !^http://www.yourwebsite.com/.*$ [NC]

#The next coding line permits the watermarked images to be accessed directly. It is according to the rule where the URL does not contain a cache.

RewriteCond %{REQUEST_URI} !(/cache/) [NC]

#It is the page where your store visitor will be redirected if they will attempt to access images directly.

RewriteRule \.(gif|jpg)$ http://en.wikipedia.org/wiki/You_shall_not_steal [R,L]

I would recommend setting up Apache/Nginx rules to prevent users from accessing paths inside the /pub/media/catalog/product/ directory, other than /pub/media/catalog/product/cache/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.