Support » Networking WordPress » upload path/url weirdness for the main blog of a multisite setup

  • We have a WP network (3.8.1 with domain mapping) that was started pre WP 3.5, so it was using ms-files.php and wp-content/blogs.dir/ to store media files. I wanted to remove ms-files.php dependency and after doing some research started the process:

    I first tried not moving any files from blogs.dir/#/files to uploads/sites/# but to setup symlinks for that. Then had some permission issues so just copied everything from blogs.dir/#/files to uploads/sites/#.

    Then cleared the values for upload_path, upload_url_path and fileupload_url on all sites.

    And finally updated/inserted ms_files_rewriting = 0 in wp_sitemeta table.

    Also added some rewrite rules to .htaccess file to not deal with updating all URLs in DB.

    The main blog id in our setup is 2 and not the default which is 1: define('BLOG_ID_CURRENT_SITE', 2);

    As far as I know and based on what I see in wp_upload_dir(), by default WP uses the root of the uploads folder for the main blog contents and uploads/sites/# for other blogs. So I have copied the content from blogs.dir/2/files to the root of the uploads folder and NOT to the uploads/sites/2.

    Now here is the issue for media files on the MAIN BLOG: on back-end, WP loads files from the uploads folder which is fine, but on front-end it tries to load files from uploads/sites/2 which doesn’t exists and is weird!

    Hey @ipstenu ! I read your blog post on this and you had a similar issue of added/repeated site/# for some sites, did you find the reason for that? I originally wanted to keep the content for main blog in uploads/sites/2 so I set that as the upload_path for the main blog. Again it worked fine on back-end but on front-end it was trying to load from uploads/sites/2/sites/2!

  • The topic ‘upload path/url weirdness for the main blog of a multisite setup’ is closed to new replies.