Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Google Images / SEO Problem
 
bobbrodie
Sr. Member
 
Avatar
Total Posts:  132
Joined:  2008-04-02
Philadelphia, PA
 

On a product page, my product images have a url of

http:/www.mydomain.com/media/catalog/product/cache/1/image/265x/5e06319eda06f020e43594a9c230972d/G/5/G508_3.jpg

Will that cache url cause problems with Google Images?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brilliand
Member
 
Total Posts:  34
Joined:  2008-08-29
 

Probably.  You can disable that by change these lines:

$this->helper(’catalog/image’)->init($_product, ‘small_image’)
$this->helper(’catalog/image’)->init($_product, ‘image’)->resize(265)

to:

$this->getImageUrl($_product)
$this->getSmallImageUrl($_product)

in the appropriate template files under /app/design/frontend/default/<theme>/template/catalog/product/.  You may also want to take the “width” and “height” attributes off the <img> tags those lines are in.

EDIT: Sorry, that doesn’t do it… those lines need to be changed to something else.  Haven’t found out what yet.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bobbrodie
Sr. Member
 
Avatar
Total Posts:  132
Joined:  2008-04-02
Philadelphia, PA
 

I tried this:

$_product->getImageUrl()

but I think that generates the same result…

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

Is there a way in the backend to turn off cache for images only?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bobbrodie
Sr. Member
 
Avatar
Total Posts:  132
Joined:  2008-04-02
Philadelphia, PA
 

I was looking around but couldn’t find anything. This issue wasn’t there a few upgrades ago.

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

I’ve only been trying Magento since 1.1.2, but it’s always done that image url mess for me.
I see in the System -> Cache Management settings page there is a whole list of things to control the cache for, but images is not in the list.
I don’t see the point in the way they are doing image caching. It makes lots of copies of the same file, and the user’s browser is caching the images too probably.

Put the media folder in your robots.txt file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bobbrodie
Sr. Member
 
Avatar
Total Posts:  132
Joined:  2008-04-02
Philadelphia, PA
 

That is an EXCELLENT idea. Thank you. The only thing I worry about is that the images in Google Image search won’t be attached to a page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brilliand
Member
 
Total Posts:  34
Joined:  2008-08-29
 

I think it would be a better idea to put something like this in your .htaccess:

RewriteRule ^(.*)/cache/[0-9]*/image/[a-z0-9]*/(.*)$ $1/$2 [R=permanent,L]

(It needs to come before “RewriteRule .* index.php [L]” but not before “RewriteEngine on")

That will always redirect Google to the original copy of the image, at least for the large images on the product pages.  (You can test this by right-clicking on the image and choosing “View Image")

Another idea is the put a similar regular expression in your template files to fix the URL Magento generates.

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

You might want to read this thread: Separating image upload from Magento functionality

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top