Site in subfolder – all pages work except home

Because when you request the document root, the rule in .htaccess does not match and the request is not rewritten to the subdirectory. So the request falls through and whatever is the default response for the document root is served (eg. /index.php if it exists).

You need to add another directive to rewrite the homepage only.

(The first RewriteRule directive is not correct either.)

For example:

RewriteEngine On
RewriteBase /subwp/

RewriteRule ^[^/]+/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

# Special case - rewrite requests for the homepage (which is also a directory) 
RewriteRule ^$ index.php [L]

Since you are using RewriteBase you can remove the /subwp/ prefix on the RewriteRule substitution strings (that’s the whole point of using RewriteBase).

error code: 523