迁移 magento 网站后 CSS 不加载
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3440854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS doesn't load after migration of magento website
提问by Rafa
I migrated my magento website to a different server, following the steps described here. Everything went smoothly, except for the fact that when I load the page, the CSS won't load, and I just get the page in plain text.
我按照此处描述的步骤将我的 magento 网站迁移到了另一台服务器。一切都很顺利,除了当我加载页面时,CSS 不会加载,我只是以纯文本形式获取页面。
I used firebug and noticed that the path the system is using to get to the CSS file doesn't exist in the FTP server. It starts with the 'minify' folder, which makes me think that something might be cached from the previous server.
我使用了 firebug 并注意到系统用来获取 CSS 文件的路径在 FTP 服务器中不存在。它从“minify”文件夹开始,这让我觉得可能从以前的服务器缓存了一些东西。
An example:
一个例子:
my_site_url/minify/1281335374/skin/frontend/default/hellouno/css/styles.css
my_site_url/minify/1281335374/skin/frontend/default/hellouno/css/styles.css
This path doesn't exist, not even in the previous server, so I'm thinking maybe these files are supposed to be generated on the fly? I'm really confused, any help will be very appreciated!
这个路径不存在,甚至在以前的服务器中也不存在,所以我想也许这些文件应该是即时生成的?我真的很困惑,任何帮助将不胜感激!
采纳答案by Nic
Sounds like an issue with your .htaccess
file. Minification rewrites are handled there. If you haven't already, make sure your .htaccess
file came over in the transfer, and make the appropriate changes if directories or anything else has been changed.
听起来你的.htaccess
文件有问题。缩小重写在那里处理。如果您还没有,请确保您的.htaccess
文件在传输中到达,如果目录或其他任何内容已更改,请进行适当的更改。
回答by Eduardo Chongkan
In my case, the problem was a missing Slash "/" at the end of the domain.
就我而言,问题是域末尾缺少斜线“/”。
Use the following to get both rows:
使用以下命令获取两行:
SELECT * FROM core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url';
Then update them manually and make sure the domain has it's final "/", otherwise it will merge the domain name with the following folder name.
然后手动更新它们并确保域具有最终的“/”,否则它会将域名与以下文件夹名称合并。
You can check whether this is your condition if when doing inspect, you see a wrong path to CSS and JS.
如果在检查时看到错误的 CSS 和 JS 路径,您可以检查这是否是您的条件。
Correct Config:
正确配置:
Incorrect Config Results in:
不正确的配置导致:
- Remember to clear the var/cache folder.
- 记得清除 var/cache 文件夹。
回答by Alan Storm
I'm going to assume you cleared your cache out. If "not having CSS" makes this hard to do via the admin, just delete the
我假设你清除了缓存。如果“没有 CSS”使得通过管理员很难做到这一点,只需删除
var/cache
folder.
文件夹。
Sometimes giving the CSS (or Javascript) merge settings a quick toggle from on, to off, to on again will force Magento to recalculate the paths.
有时,让 CSS(或 Javascript)合并设置从打开、关闭、再打开的快速切换将强制 Magento 重新计算路径。
System -> Developer -> CSS Settings
If you can't access this in the Admin, change the value manually in the database table core_config_data
(identified by the path column having the value dev/css/merge_css_files
), clear your cache and reload your page
如果您无法在 Admin 中访问它,请手动更改数据库表中的值core_config_data
(由具有值的路径列标识dev/css/merge_css_files
),清除缓存并重新加载页面
回答by Justin Samuel
I solved the issue, by changing the merge css options in the backend to no
It was a bit difficult to navigate through backend without css but managed to get there!
System > Configuration > Developer > CSS Settings
我解决了这个问题,通过将后端中的合并 css 选项更改为 no 在没有 css 的情况下浏览后端有点困难,但设法到达那里!
系统 > 配置 > 开发人员 > CSS 设置
回答by jamil
Thanks its helped me i just forget to place / in the end of the path.
谢谢它帮助了我,我只是忘记将 / 放在路径的尽头。
Before:
前:
Base URL http://mywebsitename.com
基本 URL http://mywebsitename.com
After:
后:
Base URL http://mywebsitename.com/
基本 URL http://mywebsitename.com/
Its solved all skin/css and admin problem. Cheeers
它解决了所有的皮肤/css 和管理问题。干杯
回答by Pavan Kumar
Check permissions for the folders like app/etc, var, media folders. Try to give 755 permissions to those folders. Recently I have faced the same problem and I tried with this. Then my site works fine.
检查 app/etc、var、media 文件夹等文件夹的权限。尝试为这些文件夹授予 755 权限。最近我遇到了同样的问题,我尝试了这个。然后我的网站工作正常。
回答by Nitesh Songara
Change Permission Of Skin And Media Containing All Folder TO Give Permission 755And File TO 644
将包含所有文件夹的皮肤和媒体的权限更改为授予权限 755和文件为 644
回答by mraaroncruz
If you haven't changed your site information (url and such) in the backend (or in the database) after the migration, this is the likely problem.
http://www.siteground.com/tutorials/magento/magento_configuration.htm#base_url
for the database:
in the core_config_data table
change key "web/unsecure/base_url" to your site base url ex. http://yoursite.com
good luck!
如果您在迁移后没有在后端(或在数据库中)更改站点信息(url 等),这可能是问题所在。
http://www.siteground.com/tutorials/magento/magento_configuration.htm#base_url
用于数据库:
在 core_config_data 表中将
密钥“web/unsecure/base_url”更改为您的站点基本 URL,例如。http://yoursite.com
祝你好运!
回答by elMarquis
Experienced same problem once. The solution: I'd forgotten to put trailing slashes at the end of my base_urls when I'd updated them
遇到过同样的问题。解决方案:当我更新它们时,我忘记在 base_urls 的末尾放置斜杠
System > Configuration > General > Web > Unsecure
系统 > 配置 > 常规 > Web > 不安全
Base URL http://mybaseurl.com/
System > Configuration > General > Web > Unsecure
系统 > 配置 > 常规 > Web > 不安全
Base URL https://mybaseurl.com/
If you're Admin section is out of bounds you can also set this value in the database in the table core_config_data
如果您的 Admin 部分超出范围,您还可以在表core_config_data的数据库中设置此值
Fields: web/unsecure/base_url and web/secure/base_url
字段: web/unsecure/base_url 和 web/secure/base_url
Also: Remember to flush your cache after doing this.
另外:请记住在执行此操作后刷新缓存。
回答by Dustin Odom
Mine was also the forward slash ( / ) at the end of the url in the sql database. Cleared Cache and it worked perfect.
我的也是 sql 数据库中 url 末尾的正斜杠 ( / )。清除缓存,它工作得很好。