Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styles not loading in magento due to wrong url path, how to solve this?

Tags:

php

magento

I have installed magento on my local system, everything is working fine except that the styles are not loading..

I observed that the problem was due to incorrect style sheet url when the request is being sent (found using net in firebug)..

The request url:

http://se.com/var/www/se.com/skin/frontend/default/jm_wall/css/layout.css 

The request url should be:

http://se.com/skin/frontend/default/jm_wall/css/layout.css 

How could I solve this problem?


Additional Info:

  • I have migrated from ubuntu 12.04 (fresh install) from ubuntu 10.04 (it was working fine on 10.04)
  • I have configured apache virtual hosts
  • I have set web/unsecure/base_url & web/secure/base_url to http://se.com/ in core_config_data table in the database
  • I have give full permissions to var, skin and media folders
  • Magento cache is disabled and cleaned (for safety)
like image 338
brucekaushik Avatar asked Mar 11 '13 10:03

brucekaushik


3 Answers

I faced the similar problem when I used a script to clear the cache and Re-indexing.

My friend, @brucekaushik , gave the perfect answer. I wanted to give upvote to him but could not.

Simply do the following..

  1. change directory to Magento Root
  2. RUN the following:

sudo chown -R www-data:www-data media/ var/


Thanks brother !

like image 155
Hemant Shekhawat Avatar answered Nov 18 '22 11:11

Hemant Shekhawat


Need go to sql manager and do this:

SELECT * FROM `core_config_data` WHERE `path` LIKE '%merge%'

Then change values from 1 to 0 Clear cache and all will be ok

like image 32
Nerjuz Avatar answered Nov 18 '22 12:11

Nerjuz


Friends i have solved the problem..

i redid all the steps that i have done before, like getting all the files from svn, re-importing the database, and changing the web/unsecure/base_url & web/secure/base_url, configuring apache virtual hosts etc..

but i think what solved the problem was changing the ownership of media and var directories to www-data instead of kaushik and giving those folders full permissions.

I have done this step because in the main server, the those directories were owned by www-data user..

Also, i observed that the css was loading from se.com/media/css folder, which was automatically created once the media directory was setup properly, which did not happen earlier, the directory has css files like 0a039da6028e6d636132ecd5e235f417.css etc..

the request url was something like this (from net window in firebug)...

http://se.com/media/css/0a039da6028e6d636132ecd5e235f417.css 

and not like the one i mentioned how it should be above (http://se.com/skin/frontend/default/jm_wall/css/layout.css), nor like how the request was sent (http://se.com/var/www/se.com/skin/frontend/default/jm_wall/css/layout.css)

Hope this helps someone else...

like image 16
brucekaushik Avatar answered Nov 18 '22 10:11

brucekaushik