My host has a high speed NGINX cluster.
I'd like to load my CSS, JS and media files from this cluster. I've followed these steps and added the new static domain via my DNS.
The new DNS settings have propagated successfully and I can access my static files like so http://static.example.com/wp-content/themes/mytheme/style.css.
To begin with, I would like to change the media upload URL. I have tried to add the following snippet to
/** Path to NGINX cluster */ define( 'UPLOADS', ''.'http://static.example.com/wp-content/uploads' );
When saving the above snippet to
wp-config.php and refreshing the site, my media files (images) are loading from the following URL:
As you can see, the root URL is loading before the static URL. What's the correct way to set the new upload path? Should I also perform a search and replace for the previous uploads?
I also assume that I change my JS and CSS paths in
functions.php, like so?:
// Before wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', array(), '20161025', false ); // After wp_enqueue_script('script', 'http://static.example.com/wp-content/themes/mytheme/js/script.js', array(), '20161025', false );