WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Minify Adding HTTPS to URLs in CSS (4 posts)

  1. digitalsky
    Member
    Posted 1 year ago #

    I'm running the latest version of W3 Total Cache on my site at http://www.pr-tech.com.

    It works great with MaxCDN and my other settings but I've noticed a VERY odd bug with the minify feature.

    In my CSS file I have some urls specified for my background images like so...

    background-image:url(images/background-sprite.jpg)

    When I turn on minify EVERYTHING on my site works perfectly and it doesn't cause anything to break, except when I check the minified CSS file I notice the code in my CSS has been changed to this...

    background-image:url(https://cdn4.pr-tech.com/wp-content/themes/PR-Tech/images/background-sprite.jpg)

    It's putting an HTTPS (instead of HTTP) in front of the link which is causing the background images not to work. I can't figure out for the life of me why it won't work properly. If you try that link without the HTTPS it works just fine, but obviously with the HTTPS it doesn't work.

    Any ideas? Is this a bug or am I doing something wrong? When I turn off minify and empty the page cache everything is back to normal.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. digitalsky
    Member
    Posted 1 year ago #

    On another note, I've now added links like this in the CSS file...

    background-image:url(/wp-content/themes/PR-Tech/images/background-sprite.jpg)

    However, sure enough minify still seems to be adding an HTTPS to the beginning of every link. This makes no sense at all because I have SSL disabled completely on my CDN settings.

  3. deweydb
    Member
    Posted 1 year ago #

    I had the same problem, this was my fix:
    in w3-total-cache/lib/W3/Plugin/Minify.php

    after:

    /**
             * Skip if user is logged in
             */
            if ($this->_config->get_boolean('minify.reject.logged') && !$this->check_logged_in()) {
                $this->minify_reject_reason = 'User is logged in';
    
                return false;
            }

    add:

    /**
             * Do not minify if SSL
             */
            if (w3_is_https() ) {
                $this->minify_reject_reason = 'SSL is rejected';
    
                return false;
            }
  4. deweydb
    Member
    Posted 1 year ago #

    There is probably a better fix, where you don't do the url rewriting if the $this->_config->get_boolean('cdn.reject.ssl') option is enabled, but i couldn't figure it out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic