I've been working on theming a Pages page on my local machine. This has been going fine, but now I have pushed the changes to a remote server and see that the site is trying to retrieve the .css file from the wrong directory.

On my local machine, this is fine. On the remote machine, it seems drupal is trying to retrieve the .css file from sites all:

@import url("http:/mysite.com/sites/all/themes/custom/mytheme/css/main.css");

Where as my local version has:

@import url("http://localdev.mysite.com/sites/mysite.com/themes/custom/mytheme/css/main.css");

Would anyone know why this is and how I could correct it?


1 Answer 1


May I know where you have added CSS? on theme.info file or template.php

This issue occurring because of your theme has contained an absolute path, You need to replace absolute path the relative path.

First, you need to check that, On which file this CSS has called.

Remove from there and add CSS on theme.info file or template.php file.

On theme.info you need to add like stylesheets[all][] = custom/mytheme/css/main.css

On template.php you need to add css using drupal_add_css on template_preprocess_html(&$variables).

  • Yeah, it really depends on how you have added the CSS files.
    – Jaypan
    Commented Mar 2, 2017 at 12:31
  • The .css is added to the theme's .info file, exactly like you have there: stylesheets[all][] = css/main.css. The path is accurate relative to the .info file.
    – MeltingDog
    Commented Mar 3, 2017 at 1:45
  • Are you working on multisite? Did you clear cache? Because On local your path /sites/ where on remote server path is /mysite.com/. If something is wrong with .info file then you can replace CSS from .info file to template.php file Commented Mar 3, 2017 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.