Jump to content

.htaccess prevent image download


bravo14

Recommended Posts

Hi Guys

 

I am in the world of trying to prevent copyrighted images being downloaded and have entered the following line into my .htaccess file

 

RewriteRule \.(gif|jpg|js|txt|png)$ /messageforcurious [L]

 

It works in the fact that I cannot enter the image name into the address bar, but it also prevents pages from downloading the images, is it possible to prevent the user downloading the images using .htaccess?

Link to comment
Share on other sites

To expand on mac_gyver's response:

 

It is impossible to display an image on a web page and to protect it from someone who want to have a copy of it.

 

First off, if an image is displayed to a user in a web page, it has already been downloaded to their computer. That is how it works. The image is sitting their in the user's cache. Many users may not know where the cache is or how to access it, but the reality is that it is already there. I see some sites go to great lengths in trying to prevent users from copying images. In some cases those measures actually cause more problems than the one they are trying to solve. A couple examples:

 

JavaScript to prevent right-clicking so the user can't do a  "Save as" on the image. OK, but that also prevents the user from using the other features in the context menu that they should be able to use. This behavior only pisses me off. Plus, users could simply disable JavaScript

 

Putting a transparent image on top of the 'protected' image. This is done so when the user tries to copy the image they are really only copying the transparent image on top. This can cause problems with page layouts because of the idiosyncrasies between web browsers with the more complicated positioning and layering used to accomplish this - especially with smart phones and tablets. Plus, a user can simply do a screen capture to get the image.

 

What should you do (in my opinion).

 

1. Watermark the images. That way someone can't reuse your images without people knowing they copied it from someone.

 

2. Prevent hot-linking to your images. The watermark really makes this less about protecting the image than about not letting someone to use your bandwidth. In other words, if someone has already decided to use your image on their site, preventing the hot-linking will require them to copy it and host it themselves instead of just including an image tag on their site pointing to your server.

 

So, to reiterate, you cannot prevent someone from copying the images if you are going to make it available on the internet - period. All you can do is make it marginally harder. But, even doing those things adds a lot more work and complexity that really doesn't accomplish anything because it would take someone with just a little knowledge no more than a couple seconds to still get the image.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.