Off site image blocking!
Is thier a feature or something I could do to block people from linking my images out of my domain, something like geocities or tripod does! I would like to do this for the fact that if somebody posts alot of images being accessed it will take away from my total server bandwith and resources!
|
To prevent others from linking to your images put the following in your apache config file:
Code:
Rewriteengine on and have fake_image.gif be an image saying not to link from your site (or anything you want really). --jeremy |
I have edited and added that code to my httpd.conf file so lets see if it works!
ahhhh you cant post pics here! |
It's not working! I restarted my http server aswell! Is there a spacific place I have to insert it!
|
First make sure you have mod_rewrite enabled (although apache should have errored on restart if you didn't). You can put the chunk of code in the virtual host statement of the site you want to protect. How are you testing this?
--jeremy |
Quote:
I dont have any virtual hosts set up! Just 1 main site under the /home directory! |
You should just be able to put the rewrite statements at the end of the file then (or almost anywhere outside of another statement). Are you getting any errors? You may want to turn rewrite logging on:
Code:
RewriteLog "/usr/local/apache/logs/rewrite.log" --jeremy |
Finally got this to work a bit but the image shows up as a red X and you right click and it still shows the original linking to the pic! The RewriteRule doesent seem to change the link to the image??
|
figured it out the RewriteRule \.(gif|jpg|GIF|JPG)$ http://www.your_domain.com/fake_image.gif [R,L]
Has to have these brackets {} not these () http://www.manitobamotorsports.com/m...005%20copy.jpg |
All times are GMT -5. The time now is 10:55 AM. |