Product images not showing after migration of magento website
Asked Answered
R

7

10

I recently migrated my magento website to a different server, and here's the process I used:

  1. made a dump of the database.
  2. copied all the system files from the FTP to my hard drive.
  3. emptied the VAR folder
  4. emptied the media cache folders
  5. replaced the strings in the SQL dump from http://www.oldsite.com to http://www.newsite.com
  6. restored the database on the new server
  7. modified the local.xml file to suit the new database host, login and password.
  8. uploaded the system files to the new server

Everything seems to work fine, except for the fact that the product images are not being displayed on the frontend for some reason.

For example, here's a path from an image that was supposed to be showing, which I got through firebug:

http://www.newsite.com/media/catalog/product/cache/1/small_image/113x113/9df78eab33525d08d6e5fb8d27136e95/1/_/1_9.jpg

When I search for the path of the image the site is supposed to show in the FTP, the file is actually there. I can download it and display it on my computer. I don't know why this is happening. It doesn't make any sense to me.

This /media/catalog/product/cache/ was generated by the system, because I erased it myself before uploading the site, so I guess it isn't a cache related issue.

Well, I described the issue the best I could. I hope you can help me out.

EDIT:
Hmm, it turns out the problem was the .htaccess file inside the media folder! Removed the file -> Problem solved!

Radioactivate answered 10/8, 2010 at 13:57 Comment(2)
Are the rest of the images working? That is, ones in your theme and what not?Vardhamana
yes, only product images aren't showing.Radioactivate
R
7

Just in case anyone else has the same problem, removing the .htaccess in the media folder did the trick. I don't know if that's the best possible solution though! Thanks!

Radioactivate answered 12/8, 2010 at 3:19 Comment(1)
Nope not working. Upgraded to Magneto CE 1.8.1. Tried renaming .htaccess in media folder to no avail. Didn't see anything in the httpdocs/.htaccess file to stop anything either. Restored media .htaccess. Gotta love stupid issues along side my other issue with APO addresses magically not returning shipping results now...fml.Hygro
U
4
  1. copied all the system files from the FTP to my hard drive.

This one makes me a bit suspecting. Magento has case-sensitive folders in the media folder. There would be, for instance, an 'a' folder and an 'A' folder in the same location.

If you downloaded your files unarchived (file by file) via FTP to a Windows machine, this would cause a conflict and would omit up to half your images.

Ulcer answered 11/8, 2010 at 13:58 Comment(2)
Is there a better way to do this? Just show me the way, and I'll try it out.Radioactivate
What I did was .tar.gz the whole media/catalog directory and upload it thus to the new server.Theressathereto
P
4

Change Options All -Indexes to Options -Indexes in the above mentioned .htaccess file.

Price answered 6/6, 2013 at 7:34 Comment(0)
V
2

Ok, since everything checked out with the base URL, my next suggestion is a migration path option if you have cPanel on the old server, and since most do, this should help:

  1. Create a full backup of the account using cPanel. This will create a tar.gz of the entire account.
  2. Download the tarred backup to your computer and unzip.
  3. Find home_dir.tar - this is what contains your HTML root information. You can either upload this directly to the server and untar there using SSH, or do it on your local computer and upload.
  4. Find the SQL folder in the untarred backup. There should be a dump of your database there. Use source to put that information into a new database.
  5. On the server, delete use_cache.ser and change config information for the new database.
  6. Your .htaccess should have come over in the home_dir.tar, but make sure that it's correct per our other question

Once that's done, you should be fully functional, unless you need to make changes in the database base_url for the new server.

Vardhamana answered 10/8, 2010 at 14:50 Comment(10)
There is a trailing / on my base_url . I hope you remember how you fixed it, I'm completely lost..Radioactivate
I feel sad, I guess not so many people had the same problem after all... I might have to reinstall magento, cause I don't know what else to doRadioactivate
Rafa, try the new answer if it is possible.Vardhamana
how can I download the files without using FTP?Radioactivate
After you've created the backup? You can download the backup directly from cPanel.Vardhamana
my old webserver doesn't have cPanel installed =(Radioactivate
I logged in to the old server via SSH, zipped the media folder, downloaded the zip file, uploaded the zip file to the new server, unzipped the zip file on the new server via SSH. After all this, I still have the same problem, no product images showing... =(Radioactivate
currently trying out the same method, only now with the entire site, not just the media folder.Radioactivate
not even like this.. Even though I zipped the entire site in the old server (which still works), and pasted it in the new server the same way it was (changing only the database file and removing the cache folders), the site still displays without the product images.. =(Radioactivate
Hmm, it turns out the problem was the freakin .htaccess file inside the media folder!! wow, so much trouble over one little file! Removed the file -> Problem solved!Radioactivate
W
1

Images not showing in Magento 1.7 to 1.9 upgrade:

My solution:

in /media/.htaccess

fixed options syntax:

# Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes

removed these. Maybe conflict with .htaccess in site root directory??

# For security reasons, Option followsymlinks cannot be overridden.
#   Options +FollowSymLinks
#   Options +SymLinksIfOwnerMatch
#   RewriteEngie on

also changed ownership of .htaccess to apache

chown  apache:apache /var/www/mystore/media/.htaccess

Would like opinion of why these may be causing 500 errors.

Washhouse answered 29/8, 2016 at 20:55 Comment(0)
E
0
php bin/magento catalog:images:resize

This helped me, but it take's a lot of time to complete

Esterify answered 9/3, 2020 at 11:49 Comment(0)
K
0

for magento 2.4.5 in pub//media/.htaccess

change „FollowSymLinks“ to „SymLinksIfOwnerMatch“. example:

############################################

enable rewrites

Options +SymLinksIfOwnerMatch
RewriteEngine on

## you can put here your pub/media folder path relative to web root
#RewriteBase /magento/pub/media/

############################################

Kealey answered 5/2, 2023 at 1:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.