Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Converting direct links to images into page links

         

Sgt_Kickaxe

7:28 am on Mar 2, 2012 (gmt 0)



My reports indicate that my site has accumulated a large number of links directed at my images e.g. links ending in .jpg and .png.

I'd like to have visitors land on the page that contains the image instead of directly on the images, is there a proper way of doing this? I'm thinking 301 redirects from image to page, which means mapping them all manually, but I'm not sure about htaccess syntax, or even if that's the best way.

In some cases search is giving credit to the site linking to my image as being the image owner so there are some seo factors at play as well. Have you had experience doing this? Suggestions?

aristotle

2:56 pm on Mar 2, 2012 (gmt 0)

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



Are you talking about image hotlinks? These tell a browser to fetch an image from your server and display it on someone else's webpage. It uses your bandwidth but nobody actually comes to your website.

tedster

4:13 pm on Mar 2, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's the real question - is the "linking" site using <a href="example.com/filename.jpg" or <img src="example.com/filename.jpg"> If it is using a true <a href=""> mark-up, I'd first track a few back and try to understand why.

lucy24

10:11 pm on Mar 2, 2012 (gmt 0)

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



The problem is that morally the two are different-- at least sometimes-- but your server can't tell them apart. It's the same "Referer" either way.

If the link is formatted as <a href> you can redirect. If it's an <img src> it gets messier.

Either way you are probably overdue for a hotlink rewrite-- the kind that goes

Referer is not blank
Referer is not my site
Referer is not (short list of other Authorized Exception)
Rewrite all jpe?g/gif/png requests to a picture nobody wants to look at.

That was, ahem, not meant as a cut & paste ;)

Sgt_Kickaxe

10:11 pm on Mar 2, 2012 (gmt 0)



Thanks lucy but I don't want to send anyone to a picture they don't want to look at. I want to send them FROM my picture by itself TO the page my picture is actually on.

The images are all linked to directly, e.g. text links using the href markup. The images are not hotlinked and do not appear on other sites but if someone clicks the link they land on the image url on my site and not on the actual url of the page that has the image.

Visitors get little benefit of viewing images directly on my site without some sort of context and so I need to redirect these visitors away from the image urls and onto the urls of pages that display the images.

Tedster, I tracked dozens of them, they are primarily in user generated locations such as forums that prohibit posting of images but do not block posting of image location urls and those urls become links.

majesticseo, for example, is saying that I have a large number of incoming links directly to images and that in some cases the images even outrank the pages they are on as a result. I need to make it so no visitor lands on an image url (ending in .jpg) and only land on the pages containing the images (ending in .html)

examples:
- http://www.example.com/gfx/logo.png = bad
- http://www.example.com/ = good

[edited by: tedster at 10:41 pm (utc) on Mar 2, 2012]
[edit reason] use example.com - defeat the automatic linking [/edit]

seoskunk

10:27 pm on Mar 2, 2012 (gmt 0)

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



You would have to 301 the request individually on each image request. I really don't think its a good idea though. It would be messy and not a long term solution.

The only other way I can think of doing it is ALWAYS loading the image in php script so your script loads the image, but if no referer, loads the webage instead. You would need to ref the webpage in image name and reg ex it out. I had a script like this for hotlink protection so it can be done.

This article talks about redirecting images with blank referer and although for hotlink protection it could easily be adapted to meet your needs

[alistapart.com...]