Hello and thanks in advance!
Currently I'm testing a Wordpress setup so remodel an excisting Wordpress site. As the title suggests the structure is following: site.tld is multisite with subdomain setup. Two subdomains sub1.site.tld and sub2.site.tld work fine and as expected. Now I want to create a second WP install in a subfolder of sub2.site.tld. I am aware of the fact that a subdomain basically is a subfolder but I don't want to show this to the users. I want them to see sub2.site.tld/subsite1 and sub2.site.tld/subsite2, etc.
The goal I want to achieve is to make the B2B customer feel special by having their own subfolder. However, the main content is 'pushed' so you will from site.tld hence the multisite installation. Besides making the customer feel special I actually want to give them a subsite which they can destroy if they want without currupting other data. Hence, again, the multisite installation.
What I've done so far Thanks to many volunteers here I managed a lot already. What does work so far:
I even managed to start the installation of the subsite. However, this was via site.tld/sub1/subsite1/
What does not work sub1.site.tld/subsite1 results in the Wordpress "404" error saying that the page (subsite1) doesn't excist.
Question one When looking at the folder structure it looks like this: root
So there's no .htaccess file in the sub1 folder. Should there be one?
Question two I The root .htaccess contains just the basics:
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
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).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
And the subsite1 .htaccess doesn't contain much more either:
<IfModule mod_rewrite.c>
RewriteEngine On
# Set the RewriteBase to this directory
RewriteBase /clubs/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Remove the slash before index.php or we end up at root
RewriteRule . index.php [L]
</IfModule>
How to improve these .htaccess files so sub1.site.tld/subsite1 works?
Question Two II How to improve these .htaccess files so site.tld/sub1/subsite1 redirects to sub1.site.tld/subsite1?
Question three I've had following code in the subsite wp-config file:
define('WP_HOME','https://sub1.site.tld/subsite1');
define('WP_SITEURL','https://sub1.site.tld/subsite1');
Is this relevant for this issue?
I know this has all to do with .htaccess but I can't find this needle in the haystack! I appriciate your help! If you want to argue that using the subfolder setup instead of the subdomain setup, I'm more than willing to negotiate pros and cons.
Just popped to mind the following idea: how about a single Wordpress installation in the root and a multisite Wordpress installation in a subdomain with the subfolder setup?
Worked out this idea: installed a single site in the root, turned it into a multisite (subfolder setup). Tried to move it to a subdomain but that didn't work out either. What am I missing?
So it is resolved! Unfortunately I was seriously overthinking this! All I had to do was create a folder, upload the WP files an done! I was struggling because I installed an instance in the root and moved that. It left me without the index.php and .htaccess in the root. No need for that!