...

View Full Version : htacess replace image



qwertyuiop
05-07-2005, 10:20 PM
Hi,
I already have an htacces file. I was looking for how to make the hotlinked image be replaced with a "stolen" image. Where do I add it?

Original:

Options All -Indexes

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)$ [NC]
RewriteCond %{HTTP_REFERER} !^http://othersite.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf|cur|ani|mid|mp3|mov|wma)$ - [F,NC]

Where do I put this:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|bmp|png)$ /images/stolen.gif [L]

qwertyuiop
05-08-2005, 10:12 PM
Anybody?

I just need to know how to combine the two htaccesses.

qwertyuiop
05-11-2005, 11:47 PM
Somebody? Please. I need help with the htaccess. It should be really simple.

Span
05-13-2005, 10:49 PM
Hi,
do you actually have files with all those extensions on your site? jpeg, bmp? And what about Google? Anyways, you could try the following:


Options All -Indexes
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?othersite\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
RewriteRule .*\.(swf|cur|ani|mid|mp3|mov|wma)$ - [F]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
RewriteCond %{REQUEST_URI} !^/images/stolen.gif [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/stolen.gif [R,L]

qwertyuiop
05-14-2005, 05:15 AM
do you actually have files with all those extensions on your site? jpeg, bmp?Most of them.


And what about Google?What do you mean? The google part is for allowing Google to hotlink.

So the code you posted will:
1) Allow "mysite.com", "othersite.com" and Google to hotlink these extensions: "swf, cur, ani, mid, mp3, mov, wma"
2) Replace any hotlinked image with "stolen.gif" for referers other than "mysite.com"

I'll try it. Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum