6

I currently have a multisite using sub domains setup, which works well so far:

example.com (main site)
site1.example.com 
site2.example.com
site3.example.com

The question now is whether it's possible to add a new, separate site using the URL

en.site1.example.com

When I try to create the site in my network, I get the error

Missing or invalid site address

Is multisite designed to work with a setup like this?

6

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.

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.