问题
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.
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.
An example:
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!
回答1:
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.
回答2:
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.
Correct Config:
Incorrect Config Results in:
- Remember to clear the var/cache folder.
回答3:
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
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.
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
回答4:
Thanks its helped me i just forget to place / in the end of the path.
Before:
Base URL http://mywebsitename.com
After:
Base URL http://mywebsitename.com/
Its solved all skin/css and admin problem. Cheeers
回答5:
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
回答6:
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!
回答7:
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
System > Configuration > General > Web > Unsecure
Base URL http://mybaseurl.com/
System > Configuration > General > Web > Unsecure
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
Fields: web/unsecure/base_url and web/secure/base_url
Also: Remember to flush your cache after doing this.
回答8:
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.
回答9:
Change Permission Of Skin And Media Containing All Folder TO Give Permission 755 And File TO 644
回答10:
Mine was also the forward slash ( / ) at the end of the url in the sql database. Cleared Cache and it worked perfect.
回答11:
One answer that has not been given yet that turned out to be the solution to my problem:
When transferring the Magento store from 1 host to another, what usually isn't copied over is the VirtualHost entry. In my case I had to manually recreate this and wrongfully added AllowOverride None
. This should be AllowOverride All
in order for .htaccess
files to be read and processed.
来源:https://stackoverflow.com/questions/3440854/css-doesnt-load-after-migration-of-magento-website