A multisite installation is at www.domain.com. Subsites are set for www.domain.com/subsite1, etc. WP is installed in public_html\domain , which is the folder set up in hosting place. This works as designed.

The main site (www.domain.com) is a static site (non-WP). The main page for that site is landing.php. I have changed the htaccess for domain.com to include this statement before the standard WP statements:

RewriteRule ^$ /landing.php [L]

This was the solution I came up with on my question at Mixing a custom php index page with multi-site installation ). I can't use index.php for the static page, as that will get overwritten on a WP upgrade.

So a visitor going to www.domain.com will see www.domain.com/landing.php (the static/non-WP site). A visitor going to www.domain.com/subsite2 will see that WP subsite. This also works (and was marked as the answer to that question).

Now the 'subsite2' wants to have their own domain name (example.com). This is done by:

  1. At the example.com registrar, I set the nameservers to the JustHost nameservers.
  2. At the JustHost Control Panel, I add a add-on domain, which verifies the nameservers are set properly for example.com. I point the main folder of that add-on domain to public_html/domain (the same as domain.com, the 'master' multisite site).
  3. I ensure SSL is enabled for the new example.com add-on domain (already enabled for the main domain.com).
  4. I go into the Settings of that subsite, and change the site URL to https://example.com (remembering that you shouldn't include the 'www' part).

At this point, all should be OK. But going to the new domain name (that used to be subsite2) of example.com shows me the static page of domain.com.

What additional configuration (in htaccess or in the hosting Control Panel or elsewhere) needs to be done to get example.com to display what was initially set up as subsite2 .

For reference, the entire htaccess file is as follows:

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#RewriteBase /

#rewrite to landing
RewriteRule ^$ /landing.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).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# additional security
Options -Indexes

<files wp-config.php>
order allow,deny
deny from all

# the 404 page
ErrorDocument 404 /404.php

1 Answer 1


After posting the question, I thought about the process of how htaccess can affect the URL and the results of that request. Then I realized that the new domain is one that would match this statement:

#rewrite to landing
RewriteRule ^$ /landing.php [L]

That would rewrite the domain.com request to domain.com/landing. Which is not what I wanted.

But the entire htaccess file needs to be processed. The next statements - the common Wordpress commands - check if the URL's file or directory exists. If not, then the WP site is loaded.

Since domain.com/landing is mapped to example.com's root folder, then the landing.php file in that folder exists, so that's the page that is displayed.

So what is needed is to get the processing of htaccess to the point where the WP commands will execute. Mapping inside WP for that domain.com to a subsite would then take place.

So an htaccess command has to make an exception for domain.com (the subsites' domain name in that subsite's Settings). And that is done this way:

#rewrite to landing  except specific domains
RewriteCond %{HTTP_HOST} !^(www\.)?domain.com$
RewriteRule ^$ /landing.php [L]

That condition says "if the request is not domain.com, do the rewrite rule. Since the request is domain.com, the rewrite rule is not executed, so the WP directives can be processed. And we'll get to the subsite's content, as intended.

So, if your multisite has these conditions:

  1. Static pages for the main site
  2. Subsites with their own content
  3. A subsite that is set for another domain name (set in the Site Settings by the network superadmin)

Then you need to use the equivalent of this command to get it all to work properly (the "OR" allows for multiple custom domain names for multiple subsites). Note Correction made 14 Apr 2023 for proper syntax.

#rewrite to landing  except specific domains
RewriteCond %{HTTP_HOST} !^(www\.)?domain1.com$  [NC]
RewriteCond %{HTTP_HOST} !^(www\.)?domain2.com$  [NC]
RewriteRule ^$ /landing.php [L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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