Magento CSS and JavaScript not loading due to using file system path

Magento using full path urls to access CSS files is a common error that results from two things happening:

  • Having Merge CSS Files Enabled
  • Magento being unable to read/write to the media/ folder.

To fix this issue, please ensure that:

  • The media/ folder exists in your Magento installation.
  • The media/ folder is writable by your web server.

As @flochtililoch posted on Stack Exchange:

You should check that apache actually owns the media directory, by checking first which user apache is running as, and then adjusting permissions accordingly:

chown -R <apache_user> media
chmod -R ug+w media

More information here: Magento Filesystem Permissions


I've just encountered a very similar problem when copying a site from a live server to a local dev (MAMP) apache server. The following resolved it for me:

  1. clearing media/css & media/js of all files
  2. In the database table core_config_data setting:
    dev/js/merge_files to 0 (had been 1)
    dev/css/merge_css_files to 0 (had been 1)
  3. clearing var/cache

Reloaded front & backend & now css/js files are being served correctly.