Changing Large Multisite over to SSL

I am preparing to switch my primary multisite installation to SSL and at the same time implement an SSL CDN.
1. Is there a simple way to get a list of all the domains that are mapped with the Domain Mapping plugin?
2. Is there a work around for implementing a pull CDN? Essentially, the issue relates to the uploads folder on multisite. Multisite rewrites it from /blogs.dir/1/2018/11/ to /files/2018/11/ but this makes it impossible to use a CDN for uploads without some additional coding I assume. I figure I am not the first person to run into this problem - so I am hoping you are aware of some available solutions.


  • Ash

    Hello wlpdrpat

    1. Is there a simple way to get a list of all the domains that are mapped with the Domain Mapping plugin?

    If you go to Network Admin > Dashboard > Settings > Domain Mapping > On the mapped domains section, you will all the mapped domains.

    About question 2, I am sorry I didn't completely understand. Did you have an old multisite since earlier than wp 3.5 then upgraded to the latest? And then you want to use a CDN? Please let me know a bit details about that.

    Have a nice day!


  • wlpdrpat

    Hi Ash,

    Re: Question #2

    Yes, my multisite is ancient - I got started when it was still mu. Yes, it has upgraded to the latest. I'm not sure how the latest version of multisite handles uploads. However, on my ancient version there is a wp-content/blogs.dir/ directory that includes numbered directories for each blog. Then using an .htaccess rule wp-content/blogs.dir/ is rewritten to files/ via wp-includes/ms-files.php?file=. However, the challenge with using a network wide CDN is that uploads can't be rewritten or it breaks because it has no way of knowing what blog number the image belongs to.

    I found this code you provided in a response to a similar question, that you suggested to add as a mu plugin:

    add_filter('wp_get_attachment_image_src', 'staticize_attachment_src', null, 4);
    function staticize_attachment_src($image, $attachment_id, $size, $icon)
    	if (is_array($image) && !empty($image[0])) {
    		$image[0] = str_replace( 'START OF ORIGINAL URL TO UPLOAD FOLDER', 'CDN URL TO UPLOAD FOLDER', $image[0] );
    	return $image;

    However, although I haven't tried it, I don't see how this logic/coding is going to fix the issue I am facing. Maybe this code relates to the new multisite way of handling uploads. Any thoughts on how to get it to work for the ancient version?


  • Nithin

    Hi wlpdrpat,

    Normally pointing it towards the /uploads folder should be enough tot make it work, in your case it would be the blogs.dir folder. Could I know any specific reason to point the inside the /blogs.dir/1/2018/11 etc instead of /blogs.dir folder

    You could also use a workaround as mentioned in this link:

    Did you try the above code shared in your last reply, and see whether that helps? Maybe you could further tweak it to the following, and see whether it covers your needs:

    add_filter('wp_get_attachment_image_src', 'acf_multisite_upload_fix', 10, 4);
    function acf_multisite_upload_fix($image, $attachment_id, $size, $icon){
    	global $current_blog;
    		$replace = $current_blog->blog_id > 1 ? 'blogs.dir/' . $current_blog->blog_id . '/' : '';
    		$image[0] = str_replace('blogs.dir/0/', $replace, $image[0]);
    	return $image;

    You might also find the following articles helpful:


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.