I know that this could lead to some issues with google and other search engine, anyway is it possible in your knowledge to deny direct access for image folders to browsers? Currently I'm rebuilding my website using magento using a custom template and I was thinking about adding some more security to avoid an easy stealing of contents and images. I've read that using the .htaccess and the URL Rewrite engine is of no use :


Limitations of URL rewrites

The most commom oversight with URL rewrites is an attempt to use them for static files. This simply will not work. When a request for a static file is processed, the Magento rewrite engine is not even engaged. So it is defined by the rules in the .htaccess file: if a requested file or directory exists on the server – return it directly. Magento URL rewriting requires that the request is first routed to the index.php file, which starts Magento and prodives access to its functionality including URL rewrites. Therefore, creating URL rewrites for static files, i.e. catalog images and other content of the media folder, CSS and JS files, would have no effect.

My goal would be to let browser show product image only if the images are requested whithin the product page, so if someone tries to "right-click"+"open image in new tab" should be redirected to a 403 custom page. I know that it will not solve the problem (a print-screen and a good image software will do the trick) but I will make life harder to those who tries. what do you think about it? is it possible or it doesn't worth the pain?

1 Answer 1


You don't want to do this. There is no advantage in this, except you avoid hot linking.

First how I would do it: Check the referer to be from your site.

But the downside is: More an more people are using scripts, tools and extensions to remove the referer from the header, so you end up with a lot of people who don't send one.

I don't think it is worth the time and money to invest to avoid THIS.

And you don't add ANY security. Why do you think this brings security?

  • Thanks Fabian. Hotlinking is already implemented (using the cpanel function provided by my hosting). I was just wondering if this kind of browsing (direct access to images) can be useful to prevent images download , or , to be more clear, an "easy" download of the images. I'm agree with you , this add nothing to security, it was my mistake (I need to improove my english, sorry). What I would like to do is only to close the easy road to images thieves, without sacrificing the indexing on search engines or the usabilty of the website.
    – giancarlo
    Oct 2, 2014 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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