Error 404 on Network Admin and others

The problem is that your .htaccess rules are referencing a path outside of the document root, which is not allowed in .htaccess files.

Here is the complete working code for your .htaccess file.

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

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) /subfolder/$1 [L]
RewriteRule ^(.*\.php)$ /subfolder/$1 [L]
RewriteRule . index.php [L]

The code in your wp-config.php file is correct and therefore requires no change.

error code: 523