Wordpress Multisite Upgrade Uploads Folder Questions

Viewed 43

I upgraded a Wordpress Multisite install from 4.9.15 to 5.9. and moved to a different hosting platform. On the subsites the images were not displaying and they were not attached on the upgrade. When I uploaded an image to one of the subsites media library, it would not display in the media library. I then took the old htaccess file from the 4.9.15 install and replaced the new htaccess file. After that I could upload to the media library and see the file within the subsites. Base site always worked. During the upgrade would the htaccess file be overwritten ?

I looked at a different multisite install on another site and it looks like uploads for each site are stored in separate folders. This is not the case for the site in question, the one I upgraded. All subsites seem to share the same main uploads folder. Was this the case with old versions of multisites ? And newer versions of WP multisite have different folders for different subsites ?

Below is the code from the htaccess file from the 4.9.15 site:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# 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
# Disallow access to the WP readme that contains the WP version
RedirectMatch 404 /readme.html$

# Disallow access to .git files
RedirectMatch 404 /\\.git.*(/|$)
RedirectMatch 404 /\\.git/.*(/|$)

# Disallow access to capistrano revision file
RedirectMatch 404 /REVISION(/|$)

ErrorDocument 404 /404.php

# STRONG HTACCESS PROTECTION
<Files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</Files>

# disable the server signature
    ServerSignature Off

# limit file uploads to 10mb
    LimitRequestBody 10240000

# protect wpconfig.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>

#who has access who doesnt
    order allow,deny
    
#deny from 000.000.000.000
    allow from all

# disable directory browsing
    Options All -Indexes

FileETag MTime Size
<ifmodule mod_expires.c>
  <filesmatch "\.(jpg|gif|png|css|js)$">
       ExpiresActive on
       ExpiresDefault "access plus 1 year"
   </filesmatch>
</ifmodule>
1 Answers

WordPress will update htaccess file when you change the permalink structure, usually it does between the tags of BEGIN and END WordPress.

EIDT: Since its pointed out in the comment that htaccess has been modified inside BEGIN and END tags which would allow your custom rules to be overriden if permalinks are changed or any updates are performed which contain changes to htaccess.

Some Plugin might change it and they also try to do it within their own tags.

Anything you have added as custom rules or code outside of BEGIN and END tags will be perserved in htaccess.

As for the upload directories,I think that is also configurable whether multisite is based on sub-domains or sub-directories structure.

Related