Hi, I would like to create a multisite with real domainnames pointing to my local environment. I know how to change the domainnames in the settings of each site, except for the default one. I know how to edit the hosts-file on my mac. I don’t know how to change the domainname for the first site. I don’t know how to generate certificates for them. And will this impact when they go live at some point? Any help appreciated.
In order to edit your hosts file, you’ll need to open up the /etc/hosts file. I find that it’s easiest to do this from the terminal window with nano but you can also just edit this file with any editor.
You can look at the existing records to use as an example but it should always be in the following format:
So in this case, if your domain is test.tld, you would add:
The primary domain for the first site is set in a couple of places, first, you’ll want to check your wp-config file and update the domain there.
You’ll need to update the database to replace the domain with the one you wish to use. You can use wp-cli for this or you can use the DB editor. Look for
You’ll need to edit
You’ll also want to look for the
prefix_blogs table and edit the domain set with the ID of
1 to match the domain for your primary site.
Let me know if that helps you in the right direction!
Thank you for your reply. I will give it a try.
On top of this, how do I generate a certificate for these domains to be able to use HTTPS?
At this time DevKinsta will only cover the primary domain and any wildcards from it, ie yourdomain.tld and *.yourdomain.tld
It’s not currently possible to generate certificates for other domains, but you should still be able to load those locally over HTTP as long as they are set to use HTTP in the database.