Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Gabe Livan

    (@gabelivan)

    @andyp05 It’s interesting the resulting URL starts with // and not with https:// (as that’s what it shows when checking the HTML source code of your website). It’s likely you have a filter somewhere that alters the value of WordPress’ site_url() function.

    The latest version of the plugin has a new option that allows you to alter the resulting LINK tag for the combined CSS files. To do the change you need, please place the following snippet in the functions.php file from the active child theme which in this case should be /wp-content/themes/pearl-child/functions.php:

    add_filter('wpacu_combined_css_tag', function($combinedCssTag) {
        return str_replace('//ettpro.com/', '//www.ettpro.com/', $combinedCssTag);
    });

    If you wish to keep the https:// protocol, instead of the relative one //, you can use the following:

    add_filter('wpacu_combined_css_tag', function($combinedCssTag, $params) {
        if (strpos($params['href'], '//') === 0) {
    	    $combinedCssTag = str_replace('//ettpro.com/', 'https://www.ettpro.com/', $combinedCssTag);
        }
    
        return $combinedCssTag;
    }, 10, 2);

    Let me know how it goes! I’ve tested it several times on my end and there are no issues with it. Just a reminder that you need to have the latest version (1.3.6.1) in order to use this filter.

    Thread Starter andyp05

    (@andyp05)

    I confirmed I am running 1.3.6.1. I edited the functions.php to add the lines you suggested, I cleared the cache, disabled SGOptimizer from siteground, purged Cloudflare cache, and cleared the browser cache. I get the same result. This is only happening on the combined files. All images are loading without the 301 redirect. Any ideas or things you would like me to try?

    Thanks for your help.

    Thread Starter andyp05

    (@andyp05)

    More info:

    I put the plugin in TEST mode and all css/js files load correctly.
    I turned TEST mode off and turned combine OFF. All files required a 301 redirect.
    I turned TEST mode off and turned combine ON. All combined files required a 301 redirect.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Combined css/js require redirects’ is closed to new replies.