WordPress.org

Ready to get started?Download WordPress

Forums

Multisite enabled. Images will not upload. Shows broken image icon. (7 posts)

  1. pkoleary
    Member
    Posted 1 year ago #

    Someone please help before I tear my last remaining hair out.
    Been trying to figure this out for three days and am about ready to smash my head against a brick wall.

    The scenario:
    I've had wordpress since 3.0 and it was not multisite enabled.
    I upgraded to wordpress 3.5 and then enabled multisite, and I now have 2 sites on my network.

    Original wordpress install is in a subfolder on my server: /blog

    I do believe I was having problems with image uploading on 3.5 before enabling multisite and I can't remember what I did to fix it.

    At first I would i upload an image ( I tried various image files, this is not the issue) and it would load but then show as a broken/missing image.
    I checked my server and the images were going into the blogs.dir folder, but the path to the image on wordpress would not point to the blogs.dir folder.

    I then installed the plugin 'WP Original Media Path', which didn't fix it, just created another folder on my server: DOMAIN OR SUBDOMAIN FOR MEDIA/2013/02/etc.
    I deactivated and deleted that piece of crap plugin, yet files for one of my sites is still going to the DOMAIN OR SUBDOMAIN FOR MEDIA/ folder, and when uploading files for the other site I get the error:
    “abc.jpg” has failed to upload due to an error
    The uploaded file could not be moved to /hermes/waloraweb082/b2089/etc. etc.

    The plugin just made things worse.

    I tried all the permissions tricks. I tried modifying the htaccess file, and the wp-config file, and my last option is to jump in front of a train before I hurt someone!

    current htacess file:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^index\.php$ - [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]
    
    # END WordPress
  2. Scrap the plugin first.

    Images go here:

    main site - /wp-content/uploads/YEAR/MONTH/image.jpg
    sub site - /wp-content/uploads/sites/NUM/YEAR/MONTH/image.jpg

    So we start with the basics. Is uploads there and are the permissions okay to write files? :)

  3. pkoleary
    Member
    Posted 1 year ago #

    thank you for the reply!

    plugin was scrapped.
    I think both sites would be considered subsites. I have my main non-wordpress site at the root level, index.html, etc. and wordpress is in a /blog subfolder.

    on my server, in blog/wp-content/uploads/... folder, there is no separate "sites" folder, just 2012, 2013, and snapshots folder.

    in the support page for that plugin, the dev said after deactivating to go into media.php file and delete something in there. I don't know what he is talking about.

  4. pkoleary
    Member
    Posted 1 year ago #

    before trying that plugin, images were going here:

    /blog/wp-content/blogs.dir/2/files/2013/02/image.jpg, but did not display in wordpress, just the broken image icon.

  5. I have my main non-wordpress site at the root level, index.html, etc. and wordpress is in a /blog subfolder.

    No. The main site is a main site. :)

    WordPress in the /blog/ folder will be your main WP site forever and ever :)

    /blog/wp-content/blogs.dir/2/files/2013/02/image.jpg

    That means you actually turned on Multisite PRIOR to WP 3.5. If you activate it post 3.5 it's in a different location.

    And the reason your images are broken is cause you have the wrong .htaccess.

    Try this one:

    # BEGIN WordPress
    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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress
  6. pkoleary
    Member
    Posted 1 year ago #

    I uploaded the new htaccess file and maybe this exposed the main issue, which is if I should be using multisite at all, or it is set up wrong and I need to delete them and start from scratch?

    I wanted to use multisite to work on various websites for other people, and to test them on my server, and then when the site was complete, to migrate it to a new domain and host, etc.

    my original wordpress site was in the /blog/ directory.
    the new site I added was originally in a /blog/viktoria/ folder, before I decided to change it to a multisite setup.

    after I added your new htaccess file, when I click on the viktoria site, it says file not found and the path is: blog/viktoria/wp-admin/

    the problem is there is no viktoria subfolder in my blog folder on the server. I originally made a viktoria folder and then deleted it after I thought both sites would live in the blog folder together with multisite

    yea it is getting pretty crazy. maybe I need to re-do the entire setup.

    and to make it more of a pain, when I upload images to the original wordpress site, the images are still uploading to the folder created by that WP Original Path plugin, even though the plugin has been deactivated and deleted.

  7. I wanted to use multisite to work on various websites for other people, and to test them on my server, and then when the site was complete, to migrate it to a new domain and host, etc.

    I ... would not use Multisite.

    Moving it to a new domain and host from Multisite is a hassle if you customize plugins a lot.

Topic Closed

This topic has been closed to new replies.

About this Topic