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?
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:
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 toen.site1.example.com
. Keep the option »Updatesiteurl
andhome
as well.« checked!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:
Now your site should be accessible via
en.site1.example.com
(or in my exampleen.site1.wp.tmp
):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:
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.