WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess redirect blogs.dir to default WP uploads directory (4 posts)

  1. Jacob311
    Member
    Posted 1 year ago #

    I have a multisite that uses the Add Clone Sites for WPMU (batch) plugin to clone many thousands of sites at once. The plugin works great all except it is setting the media upload path to the old structure of the blogs.dir directory.

    These are the three lines of code in the plugins files that I can find that is causing the problem:

    update_blog_option ($new_blog_id, 'upload_path', 'wp-content/blogs.dir/' . $new_blog_id . '/files');
    
    $dir_to_copy = ABSPATH . 'wp-content/blogs.dir/' . $template_id . '/files';
    
    $dir_to_copy_into = ABSPATH .'wp-content/blogs.dir/' . $new_blog_id . '/files';

    Should I change the above code to point to the default upload path or use an htaccess redirect? Either way, what is the default WP upload path?

    Also, the reason I need this changed other than the obvious need for consistency across a large network, is because when I clone these sites the thumbnails from the template sites aren't carrying through. The theme I'm using is called SportsMag by Magazine3 and they use timthumb (which I'm not a fan of), but because I finally got it working with the multisite thumbnail cloning, I need to fix this one plugin rather than change theme files again.

    I appreciate all help and advice.

  2. what is the default WP upload path?

    It depends.

    Your main site is always domain.com/wp-content/uploads

    If you were using WP Multisite 3.0 to 3.4 originally, then it's domain.com/files/ which reidrects to domain.com/wp-content/blogs.dir/#/files/ (where # is the site number).

    If you started multisite on 3.5, your images are in /wp-content/uploads/sites/#/

  3. Jacob311
    Member
    Posted 1 year ago #

    Thank you Mika. That explanation is great. I started this multisite on 3.5, so all my images should upload to /wp-content/uploads/sites/#/.

    Now is this true for subsites as well? Should there be any instances of using the blogs.dir/ directory at any point in a 3.5 WP site?

    Would you suggest I combat the plugin that is uploading to the blogs.dir by using an htaccess redirect or do you suggest I modify that code above to reflect the latest upload path?

  4. Should there be any instances of using the blogs.dir/ directory at any point in a 3.5 WP site?

    Nope.

    Would you suggest I combat the plugin that is uploading to the blogs.dir by using an htaccess redirect or do you suggest I modify that code above to reflect the latest upload path?

    I would review the plugin that's doing it and see how it was written. It SHOULD be using the constants to pull that data dynamically. If, instead, it's checking 'Are you multisite? If so, use blogs.dir' I would edit the plugin and report it to the author with a _doing_it_wrong() brick.

Topic Closed

This topic has been closed to new replies.

About this Topic