我最近将我的 magento 网站迁移到另一台服务器,这是我使用的过程:
- 转储数据库。
- 将所有系统文件从 FTP 复制到我的硬盘上。
- 清空 VAR 文件夹
- 清空媒体缓存文件夹
- 替换来自 http://www.oldsite.com到http://www.newsite.com
- 恢复新服务器上的数据库,
- 修改local.xml文件为适合新的数据库主机、登录名和密码。
- 将系统文件上传到新服务器
一切似乎都工作正常,除了产品图像由于某种原因没有显示在前端之外。
例如,这是我通过 firebug 获得的应该显示的图像的路径:
http://www.newsite.com/media/catalog/product/cache/1/small_image/113x113/9df78eab33525d08d6e5fb8d27136e95/1/_/1_9 .jpg
当我在 FTP 中搜索该站点应该显示的图像路径时,该文件实际上就在那里。我可以下载它并在我的计算机上显示它。我不知道为什么会发生这种情况。这对我来说没有任何意义。
这个 /media/catalog/product/cache/
是系统生成的,因为我在上传网站之前自己删除了它,所以我猜这不是与缓存相关的问题。
好吧,我已经尽我所能描述了这个问题。我希望你能帮助我。
编辑:
嗯,原来问题出在 media 文件夹内的 .htaccess
文件!删除文件->问题解决了!
I recently migrated my magento website to a different server, and here's the process I used:
- made a dump of the database.
- copied all the system files from the FTP to my hard drive.
- emptied the VAR folder
- emptied the media cache folders
- replaced the strings in the SQL dump from http://www.oldsite.com to http://www.newsite.com
- restored the database on the new server
- modified the local.xml file to suit the new database host, login and password.
- 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!
发布评论
评论(7)
为了防止其他人遇到同样的问题,删除媒体文件夹中的 .htaccess 就可以解决问题。我不知道这是否是最好的解决方案!谢谢!
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!
将上述
.htaccess
文件中的Options All -Indexes
更改为Options -Indexes
。Change
Options All -Indexes
toOptions -Indexes
in the above mentioned.htaccess
file.这让我有点怀疑。 Magento 在媒体文件夹中有区分大小写的文件夹。例如,同一位置会有一个“a”文件夹和一个“A”文件夹。
如果您通过 FTP 将未归档的文件(逐个文件)下载到 Windows 计算机,这会导致冲突并会忽略多达一半的图像。
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.
好的,由于所有内容都通过基本 URL 进行了检查,如果您在旧服务器上有 cPanel,我的下一个建议是迁移路径选项,而且由于大多数服务器都这样做,这应该会有所帮助:
一旦完成,您应该可以完全正常工作,除非您需要在数据库中进行更改
base_url
对于新服务器。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:
Once that's done, you should be fully functional, unless you need to make changes in the database
base_url
for the new server.Magento 1.7 到 1.9 升级中不显示图像:
我的解决方案:
在 /media/.htaccess 中
修复选项语法:
删除了这些。可能与站点根目录中的.htaccess冲突?
还将 .htaccess 的所有权更改为 apache
想了解为什么这些可能会导致 500 错误的意见。
Images not showing in Magento 1.7 to 1.9 upgrade:
My solution:
in /media/.htaccess
fixed options syntax:
removed these. Maybe conflict with .htaccess in site root directory??
also changed ownership of .htaccess to apache
Would like opinion of why these may be causing 500 errors.
这对我有帮助,但需要很长时间才能完成
This helped me, but it take's a lot of time to complete
对于 magento 2.4.5
在 pub//media/.htaccess 中将
“FollowSymLinks”更改为“SymLinksIfOwnerMatch”。示例:
##############################################
启用重写
## ############################################
for magento 2.4.5
in
pub//media/.htaccess
change „FollowSymLinks“ to „SymLinksIfOwnerMatch“. example:
############################################
enable rewrites
############################################