PDA

View Full Version : .htaccess


Buzby
15-May-2010, 05:58 PM
Having moved to a server where I get charged for bandwidth I am keen to remove hotlinking.

I am not too bothered about banning all hotlinking in forums as we do receive traffic from them so I don't want to implement a blanket ban.

I am trying to ban one particular site, and ebay.

I can ban them using a .htaccess file (details below) but this just leaves an empty place holder. I would like to add an alternate image advertising the website instead, the image is in place but just doesn't load in.

Any ideas on what I am doing wrong?

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?bloguez\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?omurtlak\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?ebay\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?ebay\.co.uk/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?facebook\.co.uk/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?facebook\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?ebay\.co.uk/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?cgi.ebay\.co.uk/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?tungstenring\.co.uk/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ qualitysilver.co.uk/acatalog/Stolen-Image.jpg [L]

Buzby
15-May-2010, 06:01 PM
This is a test page HERE (http://www.tungstenring.co.uk/TEST.htm) The image on the left is blocked, the image on the right isn't.

Any help would be appreciated.

Kind regards

Jason

Duncan Rounding
15-May-2010, 06:08 PM
If you removed the width statement out of the td on the left the image will show. Looks like the replacement statement in the htaccess file is not working.

Buzby
15-May-2010, 06:14 PM
Hi Duncan,

I have removed this but was just trying to simulate someone dragging the file into their software, as is.

Jason

Duncan Rounding
16-May-2010, 04:52 AM
This might help:
http://community.actinic.com/showpost.php?p=193840&postcount=9
and this:
http://www.alistapart.com/articles/hotlinking/
and: http://www.javascriptkit.com/howto/htaccess10.shtml

I think you may just need to include the full URL path for the image instead of the reletive path.

Buzby
18-May-2010, 07:55 PM
Many thanks for taking the time to bring this information to my attention.

I will read and hopefully succeed.

Kind regards

Jason

Darren B
19-May-2010, 06:37 AM
I forgot i cant paste a link to a place that has a great item on hotlinking :confused:

you can try a search though http://www.google.co.uk/search?hl=en&rls=com.microsoft%3Aen-gb%3AIE-SearchBox&rlz=1I7DKUK_en-GB&q=hotlinking+and+the+whole+9+yards&cts=1274251049469&aq=f&aqi=&aql=&oq=&gs_rfai=