set your CDN URL in AO to static.yourdomain.com and it should work 🙂
frank
Thread Starter
Elpo
(@elpo)
Setting CDL URL doesn’t works.
I think it’s because cookie free domain root folder is wp-content, so it doesn’t contain wp-content on urls.
indeed, for this to function your wp-content url should be static.yourdomain.com/wp-content/ else AO won’t be able to fetch the CSS/JS on that.
frank
Got the same bug.
My static domain config is:
server {
listen 80;
server_name static.site.com;
root /var/www/html/site.com/public_html;
}
wp-config.php
define("WP_CONTENT_URL", "http://static.site.com/wp-content");
I post “CDN Base URL” as http://static.site.com, but still got some js/css not comressed.
If I comment WP_CONTENT_URL everything is ok.
What I dooing wrong?
@locker: make sure to also set the WP_CONTENT_DIR constant as explained in this wordpress codex article.
there still might be a some files in wp-includes not aggregated due to a known bug that is fixed on the development-version. If you’re into that kind of things you could edit autoptimize.php to include the fix or you could download the entire in-development version here.
hope this helps,
frank
Nope, it doesn’t help for me.
will need more info if you want more help locker. a URL, to start with, maybe? 🙂
sorry, I can’t post url. domain is woc-news zone is ru
OK, time for some questions;
* you have JS optimization on and CSS & HTML optimization off, right?
* what do you have in the JS optimization exclusion list (under advanced options)?
* what do you have as CDN domain in Autoptimize settings?
* did you apply the fix from the development-version (or download the entire github zipfile to overwrite AO 2.0.0)?
frank
My config:
JavaScript Options
– Optimize JavaScript Code: yes
– Force JavaScript in <head>: yes
– Also aggregate inline JS: yes
– Exclude scripts from Autoptimize: s_sid,smowtion_size,sc_project,WAU_,wau_add,comment-form-quicktags,edToolbar,ch_client,seal.js
– Add try-catch wrapping: no
CSS Options
– Optimize CSS Code: yes
– Generate data: URIs for images: yes
– Remove Google Fonts: yes
– Also aggregate inline CSS: no
– Inline and Defer CSS: no
– Inline all CSS: no
– Exclude CSS from Autoptimize: admin-bar.min.css, dashicons.min.css
CDN Options
– CDN Base URL: http://static.woc-news.ru
My wp-config.php
define(‘WP_CONTENT_URL’, ‘http://static.woc-news.ru’);
define(‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/wp-content’);
define(‘COOKIE_DOMAIN’, ‘woc-news.ru’);
My wp-content/plugins/autoptimize/autoptimize.php
// wp-content dir, dirname of AO cache dir and AO-prefix can be overridden in wp-config.php
if (!defined(‘AUTOPTIMIZE_CACHE_CHILD_DIR’)) { define(‘AUTOPTIMIZE_CACHE_CHILD_DIR’,’/cache/autoptimize/’); }
//if (!defined(‘AUTOPTIMIZE_WP_CONTENT_NAME’)) { define(‘AUTOPTIMIZE_WP_CONTENT_NAME’,’/wp-content’); }
if (!defined(‘AUTOPTIMIZE_WP_CONTENT_NAME’)) { define(‘AUTOPTIMIZE_WP_CONTENT_NAME’,’/’.wp_basename( WP_CONTENT_DIR )); }
if (!defined(‘AUTOPTIMIZE_CACHEFILE_PREFIX’)) { define(‘AUTOPTIMIZE_CACHEFILE_PREFIX’, ‘autoptimize_’); }
Finally I update cache, but nothing happened. As you se the source code still contains a lot of css/js files.
as per the codex-article your wp-config.php is wrong;
define('WP_CONTENT_URL', 'http://static.woc-news.ru');
define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');
should actually be
define('WP_CONTENT_URL', 'http://static.woc-news.ru/wp-content');
define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');
frank