0

Simple use case, having the possibility to have both sub-directory and subdomain domains on a multisite installation, e.g. https://example.com/en for another language.

The multisite installation itself is setup as a WordPress subdomain multisite.

How to have sub-directory domains on a subdomain multisite installation?

0

I didn't find an answer on here. But on the net, it's in German. I thought I share it here, because it is a neat solution.

As suggested I added below cookie constants to the wp-config.php.

define( 'ADMIN_COOKIE_PATH', '/' );
define( 'COOKIEPATH', '' );
define( 'SITECOOKIEPATH', '' );

And replaced the content of the .htaccess with:

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 ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

After this you can create a new site, with a random subdomain. Because you still can not directly create the new site as sub-directory domain. But you can go to the edit screen of the newly created domain, and there you change the URL to the sub-directory domain you want to have.

So far it works like a charm for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.