• Hi all,
    Over the last few days my site has been having issues accessing images on subpages.
    The page has been running as multisite for around 5+ years with no problems until now.
    Images will not display under “media library” or on the website.
    I can still see all the files inside a “blogs.dir” folder for the sub sites but the main site images are inside “media” folder
    The main site remains fine with no issues & all images load ok.

    I have looked at file permissions for the files & folders to confirm they are set to 644 & 755

    I have tried to search google + this forum & have found others with similar issues but I have not found much that helped me so far.
    most suggested it could be something wrong with the htaccess file?
    I tried to make a few small changes htaccess based on what others said but i still had no luck however i really have no idea what the file does or what particular changes affect (i saved a original so have put it back to default again for now).

    If anyone could point me in the right direction on what to look for & change to fix it that would be amazing.

    Thanks in advance.

Viewing 15 replies - 1 through 15 (of 26 total)
  • If you use a plugin to get the multisite you need to ask their forum for support as they can have different .htaccess rules. include your wordpress version and the problem otherwise read https://codex.www.ads-software.com/Multisite_Network_Administration#Uploaded_File_Path
    Note* it’s called WPMU <3.0 or multisite from 3.0+ with different .htaccess for prior 3.5 from 3.0 to 3.4.2 , from 3.5+ and WPMU <3.0 (without modification plugin).
    For WPMU read issue media and .htaccess https://codex.www.ads-software.com/htaccess#WordPress_MU

    Thread Starter danacs

    (@danacs)

    Wordpress 5.2 – latest version?
    No updates are available to me.
    Has been running as mutlisite since at lease 2014 so i assume it was originally pre 3.5 – i honestly don’t remember it was that long ago.

    not using a plugin for multisite (that im aware of)

    I previously found the link you posted & have tried to change a couple of things based on that but i have had no luck yet.

    My htaccess file:

    
    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]
    

    inside my WP-config:

    
    define('WP_ALLOW_MULTISITE', true);
    
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'www.mydomain.com.au' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    
    /* That's all, stop editing! Happy blogging. */
    

    Im quite lost with this one.

    Thanks

    From the version you started with the current version, from November 2012 there is 3.5+.

    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]

    Your code for the wp-config.php file is right if it is a multisite installation on subdirectories.

    Multisite 3.0-3.4.2, where images of subsites were stored in /wp-content/blogs.dir/ and were shown in https://example.com/files/ and https://example.com / sitename / files and so on. If you started with a Multisite install older than 3.5, it is not an error if your images show with the URL of / files /.

    The link I posted to you says that the blog folder exists from wordpress 3.0 to 3.4.2… You have originated installazion from 3.0+

    Add manually htaccess and setting wp-config.php https://codex.www.ads-software.com/Create_A_Network ??

    Thread Starter danacs

    (@danacs)

    the site is running as subdirectories yes.

    I’m not sure what you mean with the htaccess code but i copy/pasted the code in your post & it did not make any difference.

    original site would have been started around 09 as single site, so obviously would have been a very old version then.
    it was then changed to multisite around 13/14 from memory.

    Full htaccess code:

    
    Options -indexes
    
    # BEGIN WordPress
    <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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    </IfModule>
    
    # END WordPress
    
    

    I assume the options indexes & ifmodule part is meant to be there?
    I don’t know much about the WP setup files.

    Thread Starter danacs

    (@danacs)

    Also from your last link posted
    https://codex.www.ads-software.com/Create_A_Network
    it states to go into network setup & copy the code into the wp-admin & htacess.
    This also did not work.

    It gave me
    WP-Admin:

    
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    define('DOMAIN_CURRENT_SITE', 'www.mydomain.com.au');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    

    htaccess:

    
    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]
    

    so damm confusing.

    For 2009 is prior 3.0 … After you have installated WPMU or upgrade your single site in 3.0?
    Prove this.

    If you installed WordPress MU in subfolder/subdirectory (not in root folder on your server via ftp) and you have problem with image library, where thumbnails and images do not show, you may need to manually add in rewrite rules for your file directories as follows:

    RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]
    Put those below the normal call for uploaded files.

    Note* Options – indexes is for not directory listing and <IfModule mod_rewrite.c> is check if load module mod_rewrite exist
    RewriteBase / this for root RewriteBase /test/ this for directory named test.

    Thread Starter danacs

    (@danacs)

    I added
    RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L] to htaaccess and it still does not work.
    I had also tried that previously also but with original htacess file not the one i have copied network setup.

    Original WP site started in early 2011 as far as i can tell.
    The dates i am going off files in media library etc to estimate the times.
    earliest files uploaded to main site is 09/05/2011
    earliest files uploaded to main site is 01/05/2014 but i have got a copy of the original wp-config file before i edited to to be multisite dated 14/5/2012 so somewhere around 5/2012 – 2014 i changed it to to multisite.

    the last bit you wrote i am unsure what you mean?
    “Note* Options – indexes is for not directory listing and <IfModule mod_rewrite.c> is check if load module mod_rewrite exist
    RewriteBase / this for root RewriteBase /test/ this for directory named test.”

    Does this mean options – indexes should be removed? I tried & it didn’t make much difference.
    im not sure where the rewritebase /test/ is you mentioned? or do you mean it should it have a rewritebase /directory/ for each directory?

    we are tangled ??
    every htaccess file needs RewriteEngine On and RewriteBase / if the file is in the root it is called / otherwise in the test folder it is called /test/. the options you need to not show the directory listing, while if you activate the rewrite alone the mod_rewrite module exists. Now in the installation folder are there really folders blogs_dir/2/ etc? if you need to insert that string in an htaccess file in folder 2.

    RewriteEngine On
    RewriteBase /2/
    RewriteRule ^([_0-9a-zA-Z-]+/)?site2/files/(.+) wp-content/blogs.dir/2/files/$2 [L]

    *this If you installed WordPress MU in subfolder/subdirectory

    Disable directory listing https://www.thesitewizard.com/apache/prevent-directory-listing-htaccess.shtml

    Thread Starter danacs

    (@danacs)

    WP is in public_html with htacess

    Media Files are in
    public_html/wp-content/blogs.dir/
    Folders 2 3 4 5
    2 /files is empty
    3 /files is empty
    4 /files/201*/month seems to have files for my test subdirectory/subsite (Site is not used any more)
    5 has the files for the website i am working on at the moment (shop subsite)

    so are you saying i need to add the following to htacess for each subsite?

    
    RewriteBase /subdirectoryname/
    RewriteRule ^([_0-9a-zA-Z-]+/)?site2/files/(.+) wp-content/blogs.dir/5/files/$2 [L]

    site2 as subdirectory name? or site5 like the blogs.dir folder? or other?

    or

    
    RewriteBase /5/
    RewriteRule ^([_0-9a-zA-Z-]+/)?site5/files/(.+) wp-content/blogs.dir/5/files/$2 [L]

    ??

    Sorry but i really have no idea when it comes to htaccess files or fixing the issue.

    create .htaccess into 5 folder

    RewriteEngine On
    RewriteBase /5/
    RewriteRule ^([_0-9a-zA-Z-]+/)?site5/files/(.+) wp-content/blogs.dir/5/files/$2 [L]

    This rule imposes a redirection from folder 5 and all its subfolders (files).
    I’m not sure about the RewriteBase /wp-contet/blogs_dir/5/ or RewriteBase /5/ well if he doesn’t like it with the browser towards https://yourdomain.com/wp-content/blogs_dir/5/ he should give errorr http 500

    Thread Starter danacs

    (@danacs)

    Unfortunately this still did not work for me ??

    I tried your suggested .htacess code with:
    – RewriteBase /wp-contet/blogs_dir/5/
    – RewriteBase /blogs_dir/5/
    – RewriteBase /5/

    With the ” ?site5/files/ ”
    is “site5” how the sub site is identified? should this be the subdirectory name? (shop) ?
    if not how does the shop subdirectory know it is “site5” ?
    is it possible this has somehow been changed? and i need to change something so shop knows it is “site5”?

    Or will it be easier to move all of the image files to a different location?
    uploads?

    thanks for the help so far, i really appreciate it.

    sorry I have no experience on old installations the public_html folder is the root in your case. is the site in this path? ^ ([0-9a-zA-Z_-]+/)?site5/files/ Optionally any letter, number, _, – and slash followed site5/files/?
    delete your previous htaccess if site5 exists creates a htaccess in the site5 folder.

    RewriteEngine On
    RewriteBase /site5/
    RewriteRule ^([_0-9a-zA-Z-]+/)?site5/files/(.+) wp-content/blogs.dir/5/files/$2 [L]

    otherwise for testing insert in your htaccess root (public_html) immediately after RewriteBase /
    RewriteRule ^([_0-9a-zA-Z-]+/)?site5/files/(.+) wp-content/blogs.dir/5/files/$2 [L]

    Thread Starter danacs

    (@danacs)

    Public html is in the root dir yes.

    is the site in this path?

    I do not understand what you mean?
    there are no site subfolders in root dir or public_html
    there is no “site5” folder.
    only /5/ in blogs.dir

    both of the above suggested codes did not work.

    I found how to check the site id.
    The site ID is 5
    so “site5” does belong to blogs.dir/5

    Options -indexes
    
    # BEGIN WordPress
    <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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    </IfModule>
    
    # END WordPress

    Delete all htaccess files and only create this one in the main root.
    upload a new image and check if you see it in the media library, if you see it it means that after a certain date the media library no longer shows the old uploads.

    Thread Starter danacs

    (@danacs)

    ^ that is identical to my original .htaccess

    I have tried to upload new files after some changes from time to time & it will not display new uploads or pre-existing files.

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Multisite images not working anymore.’ is closed to new replies.