Are nested subdomains possible with a subdomain multisite?

By now, it is possible without any plugin. WordPress allows you to edit a sites domain and path free of any restrictions once it is created.

First of all: create a new site with an arbitrary but valid subdomain:

Add a new site

After the site was created follow the »edit site« link in the confirmation message. Here you can alter the domain and/or path on your own behalf. (The default rewrite rules of a sub-domain install does not work with a path other than /.) In your case change the domain to en.site1.example.com. Keep the option »Update siteurl and home as well.« checked!

Change the sites URL

Of course, you have to make sure that the subdomain will be resolved to the host driving your WordPress install. In my local example (en.site1.wp.tmp) I added the following line to the /etc/hosts file:

127.0.0.1    en.site1.wp.tmp

Now your site should be accessible via en.site1.example.com (or in my example en.site1.wp.tmp):

The site under the new domain

If you changed the URL of a site with existing content, you might want to update references to the old URL in the WordPress database. You can use wp-cli for that:

wp search-replace en-site1.example.com en.site1.example.com --network --precise --dry-run 

The --dry-run gives you an overview of the table columns that will be affected without actually changing anything. After you backed up your data, and you double-checked your parameter, run the command without this parameter.

Leave a Comment