Forum Moderators: phranque

Message Too Old, No Replies

Stop Hotlink from Ebay

         

kstyles

10:29 pm on Sep 8, 2004 (gmt 0)

10+ Year Member



I already have an htaccess file running that stops hotlinking from specific domains/sites.
But for the life of me, I can't get it to work where Ebay is involved. An auction (not mine) is hotlinking to one of the pics on my site. And I doubt if this is the first or last time.

The page where my graphic shows has this URL
[cgi.ebay.ca...]
(correct item # removed).

I have tried all of the following and none work. As I said, I already have a file running to stop a few other specific sites and that works fine.

RewriteCond %{HTTP_REFERER} ^http://(cgi\.安ww\.)?ebay\.$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://pages.ebay\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://cgi.ebay\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(cgi\.)?ebay\.com/ [NC,OR]

Any ideas?

mivox

10:49 pm on Sep 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Rename the file, update the references on your site, and then upload a gif with the original filename that says "This image stolen from www.[yoursiteurl].com"

:)

kstyles

10:52 pm on Sep 8, 2004 (gmt 0)

10+ Year Member



That is what I have had to do for now. But what I really want to do is block them and any future ebayer from doing it again. So I need to block all access to all of my graphics from Ebay.

mivox

11:15 pm on Sep 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What about (off the top of my head):

^http://cgi\.ebay.*

Since the URL you give as the offender is ebay.ca, and there are other regional ebay urls, I think you'd want to wildcard everything after cgi.ebay, wouldn't you?

kstyles

12:29 am on Sep 9, 2004 (gmt 0)

10+ Year Member



I have tried that and it doesn't appear to work. I have done most of these with a wildcard and .com and .ca

mivox

12:52 am on Sep 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it viable to block everyone but just your site from linking directly? According to the Apache docs, that would be done with:


RewriteCond %{HTTP_REFERER}!^http://www.yourdomain.com/.*$ [NC]

And of course, if there were a handful of other 'friendly' domains allowed to access them, you could add them to the list with [OR]

Shannon Moore

12:56 am on Sep 9, 2004 (gmt 0)

10+ Year Member



mivox, that's what I do and I've experienced no ill effects from it. Of course, I periodically forget I've done it and then freak out momentarily when images are "breaking" on a new subdomain or a site I've authorized to hotlink my graphics (eg. "friendly sites"). A quick update of Apache's htaccess file returns one's heartbeat to normal should this occur.

Example htaccess:

Options +FollowSymLinks
RewriteEngine on
# prevent image hijacking
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?anotherdomain\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?friendlydomain\.com [NC]
RewriteCond %{REQUEST_URI}!^/images/forhotlinkers\.gif$
RewriteRule \.(jpeg?夸pg夙if如ng安mv妃ov)$ [mydomain.com...] [NC,R,L]

This displays a GIF named "forhotlinkers" from the mydomain.com's images folder if any graphics on mydomain.com are hotlinked from anywhere other than the domains listed above.

TEST before implementing on your site. I just swiped and example-ized my relevant htaccess lines.

jdMorgan

1:32 am on Sep 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ktyles,

Welcome to WebmasterWorld!

I suspect that you will find that your original code works for most cases if you flush your browser cache (temporary internet files) before testing any change to access restrictions. Otherwise, the image will be fetched from your local cache and not from your server. Therefore, the access restrictions on your server can have no effect.

I'd suggest


RewriteCond %{HTTP_REFERER} ^http://(cgi如ages安ww\.)?ebay\. [NC,OR]

to cover all of your listed variations, but most of what you had should have worked (the first one would not, since you end-anchored it after "ebay." but the others were OK).

Jim

jdMorgan

1:38 am on Sep 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Shannon Moore,

If you want to get sneaky, then don't give any indication that you're catching hotlinkers. Change your final two lines to:


RewriteCond %{REQUEST_URI} !^/images/forhotlinkers\.gif$
RewriteRule \.(jpeg?夸pg夙if如ng安mv妃ov)$ [b]/images/forhotlinkers.gif [NC,L][/b]

This now does an internal rewrite, which does not require the cooperation of the user-agent, silently replacing the requested image with your substitute image.

Jim

Shannon Moore

1:42 am on Sep 9, 2004 (gmt 0)

10+ Year Member



jdMorgan, thanks! I've run to this forum often enough to know you're a true guru at this stuff.

"Webmasterworld -- the next person you help may just be yourself!"

;-)