• As you know there are a lot of image upload topics like this one, but I could just not find any topic that could help me as I have a slightly different problem.

    I have a WordPress 4.2.2 running with 45+ sites. We just upgraded from 3.5 to 4.2.2 which was a great deal. Problem is that the media-uploader is now broken.

    I’m working with sub-directories

    The media upload now only works on the main site after I changed the upload path via Network > Sites > Settings to wp-content/blogs.dir/1/files.

    When I go to a sub-site to upload a file it gives me this url:
    https://santexo.acsrackserver2.nl/bouwbedrijfpostma/files/2015/05/media_xll_1105222.jpg which wordpress processes to:
    https://santexo.acsrackserver2.nl/wp-includes/ms-files.php?file=2015/05/media_xll_1105222.jpg which doesn’t work.

    When I put the blogname into the url like this:https://santexo.acsrackserver2.nl/bouwbedrijfpostma/wp-includes/ms-files.php?file=2015/05/media_xll_1105222.jpg it does work.

    Here is my .htaccess (i copied it from the old site)

    <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 [R=301,L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-content/uploads/$2 [R=301,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 ^snelstart/(.*\.xml) snelstart/orders.php [NC,L] # Handle product requests
    RewriteRule . index.php [L]
    </IfModule>

    I have been searching all over the net, but I just can’t find any topic that has a solution..

    Any one have an idea what’s wrong?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I recovered my uploaded files code as this:

    RewriteRule ^files/(..+) wp-includes/ms-files.php?file=$1 [L]

    Fixed my problem right away. My settings are:

    Directory where loaded: /wp-content/blogs.dir/[site]/[year]/[month]
    URL to retrieve: /files/[year]/[month]

    Hope that helps!

    Art

    Hello,

    I have exact issue as above stated by “wimwam”

    However i need little more details on how to fix it in .htaccess as i am not techhyy.

    Pls help.

    Thanks

    Thread Starter wimwam

    (@wimwam)

    I was not able to fix this problem, but I did make some kind of workaround for it. I made the script below in my functions.php:

    add_action( 'after_setup_theme', 'theme_setup' );
    function theme_setup(){
    global $wpdb;
    $pageid = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'uploads_use_yearmonth_folders' AND option_value = '1'");
    if(!$pageid) :
        update_option('uploads_use_yearmonth_folders', '1');
        update_option('upload_path', 'wp-content/uploads');
    endif;
    }

    Note that I am now using the folder ‘uploads’ for ALL my blogs, I am no longer using the ‘blogs.dir/$blogid’ structure.

    Pls find below details for better understanding of my problem.

    Subdomain based set up. WP Installed on domain ROOT of (A) domain below.

    1. Set up Multisite 4.2.2 WP install from godaddy cpanel installtron. As found removed .htaccess file from wp-includes.

    2. Domains:
    A. https://antifatigueboatmats.com/ as main site. Works fine, uploads & display images.
    B. FishingKitesEtc.com – 2nd one
    C. ElectricDredgeReelsETC.com – 3rd one

    3. .HTAccess is as below:
    ‘<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    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]

    </IfModule>’

    4. Asked Godaddy to do apache rewrite. they did.

    5. I go to 2nd site media and try to upload a sample image:
    It shows as crashed image. Its file url in the media after upload is: https://electricdredgereelsetc.antifatigueboatmats.com/files/2015/07/image001.png

    When i check in FTP all main site images / media are at: /public_html/wp-content/uploads/2015

    I do see in FTP that : /public_html/wp-content/blogs.dir/4/files however no files. Also this site ID of 2nd & 3rd is 8&9 not 4!

    Hope this much info is sufficient for you to help me.

    Looking to hear from you
    Thanks
    Vassi

    Pls Need help on above fixing to be done.

    I am stuck in-between and not able to see the light at the end of this tunnel.

    Help is greatly appreciated.

    Thanks
    Vassi

    Solved:

    Just had to remove everything taking back up.

    Set up new. not using one click installs, rather manual WP download & install.

    Set up first site. then added other 2 sub sites.

    Mod rewrite & MB limit as well as php memory limit. (Few more i did but dont remember, however i found those details in this forum only)

    All 3 sites are up & running without any issue.

    Thanks
    Vassi

    I am facing the same issues with my multi site install..

    not showing images –
    mainsite
    https://itechengine.com/files/2016/01/cashkaro.jpg

    subsite
    https://deals.itechengine.com/files/2016/01/paytm-idea-Rs-100-free-wallet-balance.jpg

    Upload Path = /wp-content/blogs.dir/1/files

    Upload Url Path = /files

    I can see that images are getting uploaded to the right folders

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

    please help

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘multisite image upload path problem’ is closed to new replies.