1

I currently have a multi-site install on a subdomain, let's call it example.domain.com. Generally, I want users to have subdirectory sites, such as example.domain.com/site1. However, in a few cases, I would like certain sites to appear as a subdomain rather than a subdirectory. For example, example.domain.com/site1 should be site1.domain.com.

I have installed the plugin "WordPress MU Domain Mapping" and have not had success. I mapped the NS and created CNAME records to the site.

For example:

  1. site1.domain.com is mapped to example.domain.com (CNAME points to example.domain.com) and NS updated to match those of example.domain.com
  2. In the site settings, I make sure the primary site is set to site1.domain.com and I wait a few hours to try to allow the DNS settings to update
  3. Going to site1.domain.com simply redirects me to example.domain.com. It does not serve content from example.domain.com/site1. If I type site1.domain.com/site1, I am redirected to example.domain.com/site1.

This is not the behavior I am looking for. If a user visits site1.example.com/account, I want them to stay on site1.example.com (which is serving content from example.domain.com/site1/account).

Something to note: example.domain.com is hosted via Google Cloud while domain.com is hosted via another webhost. This is why I have to update the nameservers from my example above.

I recently tired the following in my htaccess.conf, but it doesn't work either:

RewriteCond %{HTTP_HOST} ^(www.)?site1.domain.com$
RewriteRule ^(.*)$ https://example.domain.com/site1/$1 [R=301,L]

Any help would be greatly appreciated. I am not entirely sure what I am doing wrong or if this will even work.

Thank you all so much for any suggestions!

Your Answer

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

Browse other questions tagged or ask your own question.