• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

BUG Cookieless setup issue when using a subdomain

AzureTai

New member
Messages
4
Likes
0
Points
1
#1
Hey guys,

I have Clearfy Business and am loving it so far, it's permitted me to "cut the fat away" on my domains, exceptional work on this suite of plugins!

Unfortunately last night I ran into a small issue and I'm wondering if you or anyone from the community would be able to assist me.

I have the following setup for my domain's

https://www.domain.tld - cookie, servers all main content with the exception of the wp-content directory.
https://static.domain.tld - cookieless, serves content from the wp-content folder directly.

The issue I'm facing here is when I set Clearfy to minify CSS and JavaScript it's appending "wp-content" to static.domain.tld
e.g "https://static.domain.tld/wp-content/..."

This is an issue for me as the subdomain is already rooted in this folder so effectively it's looking for a non-existent folder and won't load any assets.

I'm currently using Autoptimise for minification e.t.c and had the same issue with their plugin, they gave me the following code that corrects the issue.

Code:
    add_action('autoptimize_filter_css_fixurl_newurl','subdomain_magic');
    function subdomain_magic($urlin) 
    {
        return str_replace('wp-content/','',$urlin);
    }
I was wondering if there was a similar piece of code that I could use for your plugin as ideally, id love to cut down on the number of plugins I have on my sites.
 

alexkovalev

Program developer
Staff member
Messages
201
Likes
13
Points
18
#2
Hi,

We have a similar hook that you can use on your site:
PHP:
add_action('wbcr/mac/css_fixurl_newurl','subdomain_magic');
function subdomain_magic($urlin)
{
    return str_replace('wp-content/','',$urlin);
}
Let me know if this suits you?

Best regards, Alex
 

AzureTai

New member
Messages
4
Likes
0
Points
1
#4
Unfortunately, that code doesn't seem to be working


Code:
www.druid.co.uk/:1 Failed to decode downloaded font: https://static.druid.co.uk/wp-content/themes/flatsome/assets/css/icons/fl-icons.woff2
www.druid.co.uk/:1 Failed to decode downloaded font: https://static.druid.co.uk/wp-content/themes/flatsome/assets/css/icons/fl-icons.ttf
www.druid.co.uk/:1 Failed to decode downloaded font: https://static.druid.co.uk/wp-content/themes/flatsome/assets/css/icons/fl-icons.woff
as can be seen above, the static domain still has "wp-content" appended to it.
 

alexkovalev

Program developer
Staff member
Messages
201
Likes
13
Points
18
#5
Hi,

Sorry, but it seems to me at the moment to completely solve your problem will not work.

I think this only applies to font links, because our plugin doesn't optimize fonts and font links don't pass through the php filter I gave you above. In the new releases we plan to add some features, I will try to solve your problem as well.

Best regards, Alex