Author - Robert Popovic

Founder and Technical Director of LERO9, a web agency specializing in Magento and WordPress design and development.

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (25)

  1. Mackenzie
    June 25, 2010 at 8:40 am /

    Hi Robert,

    Great post. Came across this issue myself today and you are the only one really talking about it.

    I had a slight alternate suggestion for a fix though that seemed to work a bit better. Rather than always forcing the absolute paths over https, just make the urls relative again by setting $baseUrl = ‘../../’

    Since the merged, cached css files are in /media/js/ this sets all of the paths back to the relative root again and you can avoid those pesky http/s designations all-together.

    I’ve only tested minimally, but it seems to be working, and CSS merging appears to be the only process that uses the function. I haven’t seen any major downsides with it yet. Let me know if you see any problems with it!

    1. Pete
      June 4, 2011 at 11:08 pm /

      Just to confirm mackenzie’s method works fine on a single store with a single theme with the css compiled into media/

      Thanks for documenting the issue


  2. Matt
    July 1, 2010 at 10:26 pm /

    Thanks for this!

    Had an idea that it might be something to do with the css merging; I’ve decided to disable it until they’ve fixed it. It probably won’t be a performance hit for the current site, as unlike some, it’s only using a few stylesheets.

  3. Joe Fletcher
    July 17, 2010 at 8:36 pm /

    Yeah, what a bummer that CSS merging is not working yet. I had set it up, tested it out, and all was fine – so I thought. When it came to the checkout pages (https), the backgrounds disappeared – including the continue button. I’m surprised this is still unfixed in 1.4.1. I mean, beta or not, that issue is an obvious non-starter.

    I did have good luck installing the Fooman Speedster extension. That seems to do the trick pretty well.

    Love this blog – keep it up! It’s like a Magento bug squashing tutorial. Unfortunately, you’ll probably always have lots to write about. 😉

  4. Daniel
    July 20, 2010 at 2:44 am /

    Great Article! However, for some reason this fix did not fix my problem. I tried updating the code and went into admin and cleared all cache, etc, but still had the issue. So not sure if I was able to get all the cache cleared or not.

    Might anyone know why? I definitely see a speed increase when I have the css merged.
    Please help!!!!!

  5. Daniel
    July 20, 2010 at 9:20 am /


    Yes, I made sure I cleared the files in the /media/css manually, but still the problem exists. Very frustrating.

  6. Daniel
    July 21, 2010 at 12:37 am /

    @Robert, I replaced line 733 with your code, $baseUrl = Mage::getBaseUrl(‘web’, true);, cleared all the cache.
    It appears to only be affecting my images in my css file. I have them defined like this…
    background: #014e82 url(../images/gradient-background.jpg) 50% 0 repeat-x;
    Seems to be the exact problem everyone is experiencing and what you described, “However, we noticed that when browsing the https pages, the browser would report a mix of secure and non-secure items.”
    Do you think I am still missing something?

  7. Sylvain
    November 20, 2010 at 10:12 am /

    Hi All,

    I had the same problem and I have a different approach which seems to be compatible with everything. Create merged Css file for each http and https with absolute path.
    Still in the same idea of this article, you have to override the class Mage_Core_Model_Design_Package and override the method getMergedCssUrl() and provide a different suffix if the current store is in http or https. then a merged css file will be done for http pages and an other one for ssl pages.
    The content will get absolute url background: ul(…) and the ssl file will get absolute url background: ul(…). You have nothing else to do, the correct file will be provided in the HTML header.

    class Rissip_UIOptimization_Model_Overwrite_Design_Package extends Mage_Core_Model_Design_Package{
         public function getMergedCssUrl($files)
             $suffixFilename = (Mage::app()->getStore()->isCurrentlySecure())?'-ssl':'';
            $targetFilename = md5(implode(',', $files)) . $suffixFilename .'.css';
            $targetDir = $this->_initMergerDir('css');
            if (!$targetDir) {
                return '';
            if (Mage::helper('core')->mergeFiles($files, $targetDir . DS . $targetFilename, false, array($this, 'beforeMergeCss'), 'css')) {
                return Mage::getBaseUrl('media') . 'css/' . $targetFilename;
            return '';

    I tested it and it works. I will provide soon a free module in Magento Connect to improve the css and js minifying thanks to existing libraries. It’s already finished I just need to find time to put it.

  8. TB1964
    December 7, 2010 at 4:12 am /

    if the path is not relative then you can check if it’s secure or not, so line 733 would look like:

    if (strpos($uri,’https’)===FALSE ) {
    $baseUrl = Mage::getBaseUrl(‘web’); //unsecure
    } else {
    $baseUrl = Mage::getBaseUrl(‘web’, true); //secure

    That case is would always serve the propere url’s.

    1. Sylvain
      December 7, 2010 at 5:20 am /

      This solution is ok when you don’t use cache system from Magento. Once you activate the cache from Magento, it provide http url when you need https and reverse.

      As I said, I made a free module to improve CSS and JS compression and fix the ssl problem with cache. It works with the css and js merginig function of Magento.
      Here is the link in Magento Connect:

  9. Davey
    December 18, 2010 at 1:42 am /

    Go on you legend. You’ve ended my frustration.

  10. Nicole
    January 4, 2011 at 10:30 am /

    hI Robert

    Your article talks about the issue that is a problem for me at the moment. Yesterday I set up a Positive SSL certificate on my Magento store and I have the same issue with the secure and non-secure items.
    A friend of mine, who specializes in Magento, told me this:
    “Please set css merge off and try again. For some reason you have http links to images in your compressed css files.”

    Could you please tell me, how can I set css merge off, and how to find the compressed css files?

    After HostGator installed the SSL certificate, I noticed that SEO Quake stopped showing any data related to the site, Market Samurai does not read it, HubSpot website grader does not see the website….something is not right

    can you help?
    thank you;)

  11. Nicole
    January 5, 2011 at 2:35 am /


    thank you, I have turned the merging of CSS files off. It fixed the home page, but the product pages still experience the problem. Perhaps it is related to the product images?

    “then your theme may be including a custom css file? Have you had your theme customized? if so, then ask the person who customized the theme to fix it.”
    yes, that’s a good conclusion, I will contact the authors of my theme.

    just wondering, when you update the security of your site, from http to https, do you still keep the number of backlinks pointing back at your site?

    and also,
    will Google and Robots be able to read the data describing my site?

    thank you, sorry for the non-technical jargon I might be using

    best wishes

  12. Nicole
    January 6, 2011 at 8:24 am /


    Thank you, I will get back when I solve this issue. I see in Market Samurai, that the number of backlinks is falling down. I will give them some time to settle down.
    Thanks to the links you kindly researched for me :)* I see that the http of the facebook URL can be changed into https.
    and yes,
    I would like to enable SSL for the specific pages only. I am not sure how to do it, have you written about it in another article of yours?

    many thanks:)
    Kind Regards

  13. David
    March 16, 2011 at 1:58 am /

    ah, im having this problem too, hope it gets fixed for the next new magento release.

  14. Nicolas
    July 6, 2011 at 3:20 am /

    Thanks ! It fix my problem on Magento

  15. Brenjam
    July 19, 2011 at 10:04 pm /

    Perfect, thanks. Do you use many Magento modules? We used some that did a great deal to help to speed up page page times. It took a few months to settle and function to our needs but now it’s great. Saved thousands on webserver charges by having it in the cloud! Thanks, Brenjam.

  16. pis
    August 5, 2011 at 7:28 pm /

    Thanks for this article,but it is not work on Magento 1.5,can you give more suggestion on Magento1.5.Thanks!


Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>