1

My goal is very simple to describe: I want all JS from wp-includes to be served via my CDN (cloudfront to be specific). This just means I need to change the domain from: http://mywebsite.com/wp-includes/js/some_code.js Should be served from: http://mycdn.com/wp-includes/js/some_code.js

I know this question resembles this: Serving wp-includes (front-end) javascript from a different domain?

But the answer to that Q suggested eventually to go over each and every JS in the folder and deregister/register them...This seems like a lot (!) of work to the point it's not really feasible to be done...

Is it really impossible to be achieved easily ? For comparison to do the same with wp-content, involves one line of configuration (wp-config.php): define( 'WP_CONTENT_URL', 'http://mycdn.com/wp-content');

Thanks.

3
  • 2
    Perhaps look at replacing the URLs in the response content at the webserver level. For Apache the mod_substitute extension might be of use. In IIS an outbound rewrite rule can be used to make replacements in the content.
    – Michael
    Apr 21, 2016 at 11:23
  • 1
    this is basically a duplicate of that question. If you have new info that you think is missing there then please add it, otherwise I don't see the point of asking the same question again. Apr 21, 2016 at 11:52
  • The answer on that other question looks pretty decent as well. I don't see what's difficult about doing that, particularly because you won't need to duplicate the quick tags script too.
    – Tim Malone
    Apr 21, 2016 at 12:40

1 Answer 1

0

You could use a plugin such as CDN enabler to rewrite your origin domain URLs to reflect your CDN URLs. If you only want it to change the URLs for assets within your wp-includes directory this can also be defined within the plugin.

1
  • 2
    Downvoted as here link only answers are simply not valid answers. People come here to learn to write code not to hunt for plugin recommendations. BTW it seems like the plugin does exactly what the OP do not think that needs to be done.. Apr 21, 2016 at 14:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.