Welcome to WebmasterWorld Guest from 54.159.214.250

Forum Moderators: Ocean10000 & incrediBILL & phranque

How to redirect Google images queries?

   
4:08 pm on May 12, 2006 (gmt 0)

10+ Year Member



Hi there, I am a photographer and discovered today that Google has indexed about 1K of my images from my site quite nicely, with better descriptions than Google search has for the pages they are located on. The problem is that since my pages are dynamic and I have been making quite a few category/subcategory changes, most of the URLs indexed in Google Images are no longer valid. When a user clicks on the image the user gets a automatically generated "this product no longer exists" message. I need a simple redirect code which will redirect all google images traffic to my home page. Thanks for any help!
6:05 pm on May 12, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You could probably use a mod_rewrite RewriteCond directive to test %{HTTP_REFERER} and then redirect all image-type requests to another (defined) image. It all depends on what one of these requests looks like.

Do you have a sample from your raw server access log? (Please obscure any uniquely-identifiable info -- e.g requestor IP addresses, domain names.)

Jim

7:52 pm on May 12, 2006 (gmt 0)

10+ Year Member



Here is a sample of a hit from images.google.com:


200.85.***.50 - - [12/May/2006:09:15:04 -0400] "GET /Qstore/Qstore.cgi?CMD=011&PROD=1022544466 HTTP/1.0" 200 10606 "http://images.google.com.co/imgres?imgurl=http://www.mysite.com/Qstore/upl/agrocampo2.jpg
&imgrefurl=http://www.mysite.com/Qstore/Qstore.cgi%3FCMD%3D011%26PROD%3D1022544466&h=218&w=325&sz=27
&tbnid=nx7aeD-utJbNfM:&tbnh=76&tbnw=114&hl=es&start=15
&prev=/images%3Fq%3DAGROCAMPO%26svnum%3D10%26hl%3Des%26lr%3D%26rls%3DGGLG,GGLG:2006-10,GGLG:es%26sa%3DN" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"
200.85.***.50 - - [12/May/2006:09:15:05 -0400] "GET /Qstore/upl/agrocamp.jpg HTTP/1.0" 200 2134
200.85.***.50 - - [12/May/2006:09:15:05 -0400] "GET /Qstore/upl/agrocamp.jpg HTTP/1.0" 200 2134 "http://images.google.com.co/imgres?imgurl=http://www.mysite.com/Qstore/upl/agrocamp.jpg
&imgrefurl=http://www.mysite.com/Qstore/Qstore.cgi%3FCMD%3D011%26PROD%3D1022544466&h=218&w=325&sz=27
&tbnid=nx7aeD-utJbNfM:&tbnh=76&tbnw=114&hl=es
&prev=/images%3Fq%3DAGROCAMP%26svnum%3D10%26hl%3Des%26lr%3D%26rls%3DGGLG,GGLG:2006-10,GGLG:es%26sa%3DN
&frame=small" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"

thanks

[edited by: jdMorgan at 1:20 am (utc) on May 13, 2006]
[edit reason] Obscured specifics, fixed side-scroll [/edit]

1:33 am on May 13, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It looks like testing %{HTTP_REFERER} would do it, possibly combined with a test of %{QUERY_STRING} to make the rule more specific (if you have other image URLs that you *do* want Google images to work with).

Jim

1:56 am on May 13, 2006 (gmt 0)

10+ Year Member



I don't know how to write the code myself, only to modify it slightly...would this take a lot of code to make work? I tried putting a 301 redirect in both my htaccess and httpd.conf file to redirect a couple of the invalid URLs but it didn't work.
4:59 pm on Jun 1, 2006 (gmt 0)

10+ Year Member



JD is there a way to simply redirect ALL incoming traffic from images.google.com to one page? With this latest big daddy update traffic to my pages has plummeted but image searches are much stronger...possibly also becaused i went through and renamed my images and made sure they all had meta tags. The problem is the individual pages these images are embedded in are long gone. Google has 835 images indexed from my site and most of them link to dead pages. I simply want to reroute them all to my home page where they can search for the image if they want. Is there a simple way to reroute all traffic from one URL? Thanks
8:09 pm on Jun 1, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You can't redirect an image request to an hTML page -- The browser expects an image, and the HTML mechanism used to load images is completely different from that used to load pages. So, as I posted above, you could redirect all G image requests to a single image, or redirect each image to its replacement's URL, the latter being the best approach if you really have to change your URLs.

We can't write code on demand here -- the demand would simply be too great for the limited number of contributors here to keep up with. We'll be happy to answer specific questions to help you get started learning to do it yourself, though. A good place to start is with the documents cited in our Forum Charter [webmasterworld.com]. Alternately, a search on WebmasterWorld may turn up some previously-posted code to serve as an example.

Jim

8:38 pm on Jun 1, 2006 (gmt 0)

10+ Year Member



Google images doesn't index only the images...it indexes the HTML pages where the images are located. Google doesn't send people directly to the image, but rather the page itself where it was embedded...presumably becuase they might get into a heap of copyright trouble otherwise.Here is a typical google images URL:
http://images.google.com/imgres?imgurl=http://www.mysite.com/Qstore/uploads/sagfamwin.jpg&imgrefurl=http://www.mysite.com/Qstore/Qstore.cgi%
3FCMD%3D011%26PROD%3D1019662770&h=324&w=229&sz=34&hl=en&start=1&tbnid=c0SFBs8jlpas9M:&tbnh=114&tbnw=80&prev=/images%3Fq

So basically when people click the top frame of the google image search results page which shows the image directory URL on my server it's fine since the image hasn't moved, but the actual page where it can be found (the bottom frame of a Google image search) is what can't be found. I am not concerned with people not being able to find the JPEG, but rather the page where the JPEG is embedded. Keeping that in mind would it still be impossible to route them seeing that the URL is bifurcated?

8:41 pm on Jun 1, 2006 (gmt 0)

10+ Year Member



maybe a simpler question: is it possible to redirect all traffic from a subdomain of google (images.google.com) to my home page, or would that code then redirect ALL google.com traffic to my site to the home page?
9:24 pm on Jun 1, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Yes.

RewriteCond %{HTTP_REFERER} ^http://images\.google\.com/imgres\?imgurl=http://www\.[i]mysite\.com[/i]/Qstore/uploads/
RewriteRule ^Qstore/(Qstore\.cgi¦upload/[^.]+\.jpg)$ http://www.[i]mysite.com[/i]/ [R=301,L]

Change the broken pipe in the RewriteRule pattern to a solid pipe before use; Posting on this forum modifies pipe characters.

Jim

7:35 pm on Jun 7, 2006 (gmt 0)

10+ Year Member



unfortunately it doesn't work...I'm not trying to redirect the uploads folder...those are fine. I'm trying to redirect any hits to the dynamic pages back to my home page. I'm not sure why the references to the uploads folder is there...please explain
12:28 am on Jun 8, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



...because you included log entries with 'uploads' in them above, and I don't know your site.

So what specific URL-paths do you want to rewrite?

Jim

12:59 pm on Jun 8, 2006 (gmt 0)

10+ Year Member



I want to redirect all links from google images to [mysite.com...] theis could include 800+ specific URLS, so I don't want to redirect individual URLs, just the whole shebang. If it's easier to redirect all google image requests to just [mysite.com...] then we can do that too. The problem is that Google has very outdated links from last year indexed for my site. While i am waiting for Google to sort out it's indexing probs I am losing a ton of image search traffic everyday because the linked pages don't exist anymore.
9:54 pm on Jun 8, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Using this log entry:

200.85.***.50 - - [12/May/2006:09:15:05 -0400] "GET /Qstore/upload/agrcamp.jpg HTTP/1.0" 200 2134

We'd get:


RewriteCond %{HTTP_REFERER} ^http://images\.google\.com/imgres
RewriteRule ^Qstore/upload/[^.]+\.jpg$ http://mysite.com/Qstore/Qstore.cgi [R=301,L]

Jim
7:44 pm on Jun 9, 2006 (gmt 0)

10+ Year Member



No this still isn't working...should this be placed in the htaccess file in the root level or in the Qstore directory?
8:45 pm on Jun 9, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



As written, it would go at Web-root level, since "Qstore/upload/" is included in the RewriteRule pattern.

Jim

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month