logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Allow images to be not accessed
Author
tsbalaban



Joined: 11 Jul 2009
Posts: 2

PostPosted: Sat 11 Jul '09 7:15    Post subject: Allow images to be not accessed Reply with quote

Code:

<FilesMatch "\.(gif|jpg|png|swf)$">
  SetEnvIfNoCase Referer "http://(www\.)?artofliving.com/.*" local_referer=1
  Order allow,deny
  Allow from env=local_referer
  ErrorDocument 403 "http://www.artofliving.com/stolen_file.png"
</FilesMatch>


The above works on my server in .htaccess and my local Apache server in http.conf. I tested this by changing the first artofliving to another host. However changing .png to .html does not work.

Also, unfortunately, the context menu thru the right mouse has "Save Picture As" (IE) or "Save Image As" (Firefox) which does not work anywhere. It is very easy to copy an image this way.

Thank you for any help.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Sat 11 Jul '09 14:44    Post subject: Reply with quote

I'd do it with mod_rewrite

Code:

RewriteEngine on
 RewriteCond %{HTTP_REFERER} !^http://artofliving.com.*$ [NC]
 RewriteCond %{HTTP_REFERER} !^http://www.artofliving.com.*$ [NC]
 RewriteRule .*\.(gif|jpg|png|swf)$ http://www.artofliving.com/stolen_file.png [R,NC]


If you still have a question please ask again.
Back to top
tsbalaban



Joined: 11 Jul 2009
Posts: 2

PostPosted: Sun 12 Jul '09 9:18    Post subject: Going to new page Reply with quote

Your method works but substituting png with html does not bring up a new"Not Authorized" page to the screen. How do you bring up a new page?

Also in Internet Explorer and Firefox is a menu item "Save Image As" brought up by the context menu that still allows one to save photos. How do I disable this menu item in the context menu thru Apache directives or php.ini?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Mon 13 Jul '09 12:07    Post subject: Reply with quote

Once the people have the image in their cache they can save the images. You can't disable that. No chance at all.

To your first question: Thanyou have to define your own error page.


Code:

RewriteRule .*\.(gif|jpg|png|swf)$ http://www.artofliving.com/yourpage.htm [R,NC]
ErrorDocument 403 /yourpage.htm
Back to top


Reply to topic   Topic: Allow images to be not accessed View previous topic :: View next topic
Post new topic   Forum Index -> Apache