How To Stop The Image URL In Apache

Home » CentOS » How To Stop The Image URL In Apache
CentOS 6 Comments

Hi,

While clicking on the image it opens into the browser. I dont want to allow client to open the image in browser as separate url. I have blocked the
/image/ directory from access/listing , but the image is opening.

ex. http://example.com/images/1.jpg . The image should not open in browser with this URL.

How to stop that in apache. Please help me.

Shital S.

6 thoughts on - How To Stop The Image URL In Apache

  • Not possible. There is nothing in the http protocol that differentiates between a file being displayed inline inside other content and being downloaded separately. All the webserver knows is that the file was requested from the server and it delivers that file.

    There are tricks you can do with client-side javascript, or with checking the referrer or user agent, etc. but all of them are easy to circumvent, and note that regardless of what you do that file has to be downloaded in order to be displayed in any capacity.

    Peter

  • Thanks Peter,

    But I get it resolved. The setting is in Apache server itself. By adding rewrite rule into apache or .htaccess. Below is the code and it worked.

    RewriteEngine

  • You’re referrer trick will only work against someone who doesn’t know how to (easily) circumvent it.

    Peter

  • There is sort of fundamental question:

    is the image delivered to my machine? Yes, as it is displayed within some other content. And as it is on my machine I will be able to save it as a separate file. Then, what’s the point of blocking “direct URL”?

    Thanks. Valeri

    ++++++++++++++++++++++++++++++++++++++++
    Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247
    ++++++++++++++++++++++++++++++++++++++++