These 3 steps will help you to set up cookie free JavaScript, CSS and other files for your WordPress installation. (This is especially helpful for changing the domain of certain JS/CSS file references added by plugins.)
Before you start, make sure your blog URL has a leading www (e.g. www.example.com, not example.com). (Cookie-tech-stuff)
Step 1) Create a sub-domain pointing to your real web root (e.g. static.example.com).
Step 2a) Install CDN Rewrites plugin. (Did not work for me, so I had to revert to another way). If this is you as well, enter step 2b.1.
Step 2b.1) Install Free CDN plugin. Change its settings if you want to.
Step 2b.2) Edit /wp-content/plugins/free-cdn/free-cdn.php.
Find
if (isset($parts['port']))
{
$parts['host'] .= '.$parts[port].nyud.net';
unset($parts['port']);
}
else
{
$parts['host'] .= '.nyud.net';
}
around line 282. Right after this add:
$parts['host'] = 'static.example.com'; // my own edit
and make sure the domain matches the one you set up in step 1.
If you want to keep your edit safe, change the version number of the plugin to something like "1200" (at the beginning of the file) so that WP won't suggest updating the plugin.
[UPDATE: Remember to set WP cookie domain in wp-config.php: define('COOKIE_DOMAIN', 'www.yoursite.com');]
Post a Comment