WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Uploads folder location from single to multiple sites (16 posts)

  1. daricedotorg
    Member
    Posted 4 years ago #

    I upgraded my single weblog site to 3.0-beta1 and enabled multi sites as I'm planning to create more weblogs in the future. It all went flawless, only problem is the path to upload media changed to "blogs.dir".

    When I upload an image from my default weblog it won't link correctly to the image path:

    <p><img src="http://www.mysite.org/files/2010/04/ziggo-speed.jpg" alt="Ziggo" title="Ziggo" class="alignnone size-full wp-image-1140" height="336" width="540"></p>

    The image is missing in my post preview.

    Secondly in the Media Libary all images links are broken.

    Is there a way to just default the uploads folder back to "uploads" like it was before enabling multi users?

  2. For what it's worth, it 'redirects' images to the blogs.dir.

    My images too appear to be at http://www.mysite.org/files/2010/04/ziggo-speed.jpg BUT they redirect to the blogs.dir correctly.

    If I go to
    http://www.mysite.org/wp-content/blogs.dir/1/files/2010/04/ziggo-speed.jpg

    It still works. Are both those URLs working for you?

  3. daricedotorg
    Member
    Posted 4 years ago #

    The first URL does not work for me, the second one does.

    I digged deeper in the settings and in Super Admin -> Sites -> Edit

    The upload path is the way I want it: /var/www/vhosts/mysite.org/httpdocs/wp-content/uploads, but when uploading from the the "Posts" editor it still goes to 'blogs.dir'.

    Also "Media Library" still has all images broken...so either wise I have a setting wrong or it is a bug in WP3.

  4. Firstly, no, you can't switch the uploads path back to uploads. It's just ... yeah. Doesn't work right.

    Secondly, I think your permalinks are 'bad'. Your htaccess (for WPMU) is a bit more complex than for old WP.

    This is mine:

    # BEGIN WordPress
    
    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress
  5. daricedotorg
    Member
    Posted 4 years ago #

    Thanks, that was indeed the problem. Images uploaded after enabling MU do display in the Media Library. The ones uploaded before MU don't, will have too look more into it.

    But the images do show up in my posts now so that's solved! Thanks again.

  6. The ones uploaded before MU don't, will have too look more into it.

    I think, if you copy them up to the new location, they will.

    When I moved mine from regular to MS, I moved all the files from /uploads and put this in my .htaccess BEFORE the WordPress stuff.

    RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.mysite.org/files/$1

    That said 'Everything you think is in uploads is in files, let WordPress sort it out.'

  7. daricedotorg
    Member
    Posted 4 years ago #

    Thanks! I will try that.

  8. daricedotorg
    Member
    Posted 3 years ago #

    That solved the problem, thanks.

  9. Matt
    Member
    Posted 3 years ago #

    I was having this problem as well and this fixed it - thanks for the info! You saved me a lot of headache ^_^

  10. moxietoday
    Member
    Posted 3 years ago #

    Hey everyone, I am having the same problem when I switched my single user blog over to WordPress 3.0

    I have 6 additional blogs being set up on the network as we speak, however we are unable to load any images to the posts. I went into my htaccess file which is in my htdocs root folder. I replaced the text that was there with the text Ipsentu posted above:

    # BEGIN WordPress

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    After doing this I still am unable to load images into the post window. When we do upload an image it appears as broken. PLEASE HELP!

  11. Did you put this bit in as well, before the WordPress section:

    RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.mysite.org/files/$1

    Also, check your site settings at Super Admin -> Sites -> Edit (for the site) and see what the uploads directory is set to.

  12. moxietoday
    Member
    Posted 3 years ago #

    I found another one of your posts from about a month ago and you said to use this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>

    I used the above and I also checked my upload path like you said. I changed that path to the same path as my main blog. Now the pictures are loading perfectly. Should every new site that is created on my network have the same URL path as my main site (.../wpcontent/uploads) ?

    I love WordPress! Honestly, I love it. And I love the people that are involved with WordPress. A real community. Thank you for responding to my post just 2 hours after I made it. I am interested in developing my own theme, any suggestions for reading/researching tips?

    Dan

  13. The if module wrapping is the only diff between the two code blocks there for .htaccess - They're the same and they ARE the MultiSite defaults :)

    I changed that path to the same path as my main blog. Now the pictures are loading perfectly. Should every new site that is created on my network have the same URL path as my main site (.../wpcontent/uploads) ?

    Actually, the goal is to change from wp-content/uploads to wp-content/blogs.dir/<blognum>/files

    For Blog #1, change it back to wp-content/blogs.dir/1/files

    Copy all the folders from wp-content/uploads into wp-content/blogs.dir/1/files so you get wp-content/blogs.dir/1/files/2010/01/file.jpg and so on.

    Then put this ABOVE that WordPress block in your .htaccess:
    RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.mysite.org/files/$1

    This will tell your blog that wp-content/uploads is really /files, which that big code block will correctly parse for you.

    I know it sounds weird, but the idea is to have a separate upload folder per blog, and we have to adapt your old site (which used the uploads folder) to 'learn' the new location.

  14. moxietoday
    Member
    Posted 3 years ago #

    Then put this ABOVE that WordPress block in your .htaccess:
    RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.mysite.org/files/$1

    above you say to insert...http://www.mysite.org/files/$1 above the wordpress block in htaccess. what is "the wordpress block". also, where you say "mysite.org", would i insert moxietoday.com (my website domain name is moxietoday.com)?

    I am sorry for asking so many questions, I am just trying to learn.

  15. moxietoday
    Member
    Posted 3 years ago #

    now all my images are not working on my main site. here's what my .htaccess file looks like:

    <IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.moxietoday.com/files/$1
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>

    my upload path in the super admin > sites > edit is ....

    wp-content/blogs.dir/1/files/

    Any help is much appreciated.

  16. DanMichel
    Member
    Posted 3 years ago #

    RedirectMatch 301 /wp-content/uploads/(.*)$ http://up.mysite.com/files/$1 ?

Topic Closed

This topic has been closed to new replies.

About this Topic