Yes, it is possible to map a WordPress multisite installation to a subdirectory on another domain. Here is one way to do it:
Set up the WordPress multisite network on xyz.domain.com.
Create a new site in the network for the subdirectory you want to map to (e.g. “blog”).
Install and activate the plugin “WP Super Cache” on the network.
In the WordPress dashboard, go to Settings > WP Super Cache and enable caching.
In the WordPress dashboard for the site you want to map to the subdirectory, go to Settings > Reading and set the “Site address (URL)” to the desired subdirectory URL (e.g. “anotherdomain.com/blog”).
In the root directory of the site xyz.domain.com, create a new .htaccess file and add the following code:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [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).*) xyz.domain.com/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ xyz.domain.com/$2 [L]
RewriteRule . index.php [L]
In the root directory of anotherdomain.com, create a new .htaccess file and add the following code:
RewriteEngine On
RewriteBase /blog/
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).*) xyz.domain.com/$1 [L]
RewriteRule ^(.*\.php)$ xyz.domain.com/$1 [L]
RewriteRule . index.php [L]
This should allow users to access the WordPress multisite installation at xyz.domain.com from the subdirectory “anotherdomain.com/blog”.
Note: This is just one way to achieve the desired result. There may be other methods as well. This method worked for my website vanityroofing.ca.
-
This reply was modified 2 years, 2 months ago by
bcworkz. Reason: defanged superfluous link