Forum Moderators: phranque

Message Too Old, No Replies

Can a hotlink to an image be 301'd to a web page?

         

Marcia

12:08 am on Dec 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got a constant problem with one site, with people hotlinking to a product image from "community" sites, and then also in email messages. Some I can see, the emails and some "community" pages I can't. I tried moving the graphic and renaming the image, but it was found and started over again. The ame thing is happening with some background graphics, but its far worse on the site with the product.

Is there any way to do a rediret from an image when it's hot-linked so that they're taken to the product page it appears one?

I'd guess not, but it can't hurt to ask.

jdMorgan

1:18 am on Dec 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, the problem is that -simply put- an image is handled inside the current browser window, while loading another HTML page is handled either in a new window or by completely changing the contents of the current one. As a result, not only are the routines used to process the two kinds of resources (pages versus images) different, they're also handled at different levels in the browser software. As you know, pages are invoked with <a href="xyz"> while images are invoked with <img src="abc"> -- they're just two completely-different processes.

Are you already blocking non-blank referrers that are not your own site? If so, return a low-resolution image with your URL in it instead -- that's one way to get a bit of benefit from it...

I use three levels of anti-hotlinking response:
1) Return a 403 response, yielding a broken image on the hotlinking site (most common)
2) Return alternate image with embedded link (less common, used where the site's traffic might actually convert)
3) Creative, scary, or spiteful substitute images -- Make 'em regret doing it, for a fast response (rarely used).
My use of these methods depends on how "serious" the hotlinked-to site is (e.g. e-commerce versus hobby site) and how much of a problem the hotlinking is causing.

You could also automate the process of changing your image links by using PHP or SSI to change the links on on your pages, and then using mod_rewrite to re-map the modified links back to the real files.

For example, take the current day, year, and month and mix that in with the actual image name. In mod_rewrite, check that the requested URL has the current day, month, year (allowing for transitions at midnight, etc.) and if so, strip them out, re-arrange what's left, and use that to get the right file.

We had a thread about doing this (last year?) and it might still be findable with a site search on "hotlink" with RewriteCond and TIME_DAY or TIME_WDAY or the other time variable names.

Jim

Leosghost

1:18 am on Dec 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you can block specific ( single or multiple ) referrers from accessing specific images via htaccess ..
and you can do something similar ( that redirects )in perl or PHP ( but it would mean changing your headers )..

redirecting them to another page was discussed here before ..

[webmasterworld.com...]

hehe while I was trying to see if it could be done via PHP sucessfully ( I'd already found last years thread ) ..Jim mentioned it ( presume it was this one? ) ..

I think it could be done "semi successfully" ( with all of Jims previous caveats ) with htaccess and PHP and better with perl ( but my perl isn't good enough )..anyone got a 100% working redirect for specific referrers?

edit spelling

[edited by: Leosghost at 1:25 am (utc) on Dec. 2, 2006]

jdMorgan

2:17 am on Dec 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



LeosGhost,

No, the one I had in mind is here [webmasterworld.com]. It discusses a method to make image links that are only valid for three hours.

Jim

Leosghost

3:01 am on Dec 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Now that is an interesting thread ..and I can well see why your eyes got blurry ..mine too ( it's 04.00am here ) ..I'll try to digest that one tomorrow ..thanks for the link :)