# How to add subdomain for wp multisite?

**URL:** <https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867>\
**Category:** Support\
**Tags:** installation, windows-10, multisite\
**Created:** [January 13, 2021, 3:36am UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867 "2021-01-13T03:36:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mulli](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/mulli/32/12287_2.png) [@mulli](https://community.localwp.com/u/mulli)\
**Post date:** [January 13, 2021, 3:36am UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/1 "2021-01-13T03:36:09Z")

</div>

I managed to install (migrate an existing) wp multisite on Local.  
WP multisite is using subdomains.

I simply do not know how to add the subdomain that I need.  
Current installation finds only the main domain.

Questions:

1. Where do I find the hosts file to modify?
2. Main domain is “ben.local” how do I add “eng.ben.local”?

I am using ngynx, d

#### System Details

- Local version 5.9.7+5156

- Windows 10 Professional\_

- Attach the Local Log.

```auto
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:55.321924Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 15652","timestamp":"2021-01-12T18:30:57.499Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:55.323884Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2021-01-12T18:30:57.500Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:57.465650Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2021-01-12T18:30:57.500Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:57.499919Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16' socket: '' port: 10035 MySQL Community Server - GPL.","timestamp":"2021-01-12T18:30:57.501Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Creating MySQL database...","level":"info","timestamp":"2021-01-12T18:30:57.838Z"}
{"thread":"main","class":"HostsFileService","stdout":"Updating hosts file at C:\\WINDOWS\\System32\\drivers\\etc\\hosts\nUpdated hosts file at C:\\WINDOWS\\System32\\drivers\\etc\\hosts\n","stderr":"","level":"info","message":"Updated hosts.","timestamp":"2021-01-12T18:30:58.381Z"}
{"thread":"main","class":"WordPressInstaller","message":"Init WordPressInstaller","level":"info","timestamp":"2021-01-12T18:30:58.388Z"}
{"thread":"main","class":"WordPressInstaller","message":"Starting standardInstall()","level":"info","timestamp":"2021-01-12T18:30:58.389Z"}
{"thread":"main","class":"WordPressInstaller","message":"maybeGetLatestVersion()","level":"info","timestamp":"2021-01-12T18:30:58.389Z"}
{"thread":"main","class":"WordPressInstaller","latestOfflineWpVersion":"5.6","level":"info","message":"Latest offline version info","timestamp":"2021-01-12T18:30:58.390Z"}
{"thread":"main","class":"WordPressInstaller","version":"5.6","download":"https://downloads.wordpress.org/release/wordpress-5.6.tar.gz","level":"info","message":"Latest version info","timestamp":"2021-01-12T18:30:58.984Z"}
{"thread":"main","class":"WordPressInstaller","message":"Configuring wp-config.php","level":"info","timestamp":"2021-01-12T18:31:50.330Z"}
{"thread":"main","class":"WordPressInstaller","message":"Installing WordPress","level":"info","timestamp":"2021-01-12T18:31:50.673Z"}
{"thread":"main","class":"WordPressInstaller","message":"Attempting to delete Akismet and Hello Dolly","level":"info","timestamp":"2021-01-12T18:31:52.535Z"}
{"thread":"main","class":"WordPressInstaller","message":"Writing salts to wp-config.php","level":"info","timestamp":"2021-01-12T18:31:54.031Z"}
{"thread":"main","reason":{},"p":{},"level":"warn","message":"Unhandled Rejection.","timestamp":"2021-01-13T02:08:04.871Z"}
{"thread":"main","class":"Process","process":"mailhog","pid":21560,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.016Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":6684,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.030Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":6836,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.043Z"}
{"thread":"main","class":"Process","process":"nginx","pid":16584,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.058Z"}
{"thread":"main","class":"Process","process":"mysql","pid":4616,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.071Z"}
{"thread":"main","class":"Process","process":"php-adminer","pid":16936,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.085Z"}
{"thread":"main","class":"SiteProvisionerService","message":"Creating site folders...","level":"info","timestamp":"2021-01-13T02:08:48.083Z"}
{"thread":"main","class":"SiteProvisionerService","message":"Copying service config templates...","level":"info","timestamp":"2021-01-13T02:08:48.086Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2021-01-13T02:08:48.221Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"dataPath":"C:/Users/Lenovo/AppData/Roaming/Local/run/rFXm4bpWE/mysql/data","level":"info","message":"Initializing MySQL datadir...","timestamp":"2021-01-13T02:08:48.394Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2021-01-13T02:08:55.752Z"}
{"thread":"main","class":"Process","process":"nginx","pid":20128,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:56.176Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Setting up MySQL user...","level":"info","timestamp":"2021-01-13T02:08:56.623Z"}
{"thread":"main","class":"HostsFileService","level":"info","message":"Updating hosts with","timestamp":"2021-01-13T02:08:56.717Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:55.982723Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 11076","timestamp":"2021-01-13T02:08:58.058Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:55.984278Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2021-01-13T02:08:58.058Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:58.017218Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2021-01-13T02:08:58.059Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:58.058574Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16' socket: '' port: 10041 MySQL Community Server - GPL.","timestamp":"2021-01-13T02:08:58.059Z"}
{"thread":"main","class":"HostsFileService","stdout":"Updating hosts file at C:\\WINDOWS\\System32\\drivers\\etc\\hosts\nUpdated hosts file at C:\\WINDOWS\\System32\\drivers\\etc\\hosts\n","stderr":"","level":"info","message":"Updated hosts.","timestamp":"2021-01-13T02:08:58.461Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Creating MySQL database...","level":"info","timestamp":"2021-01-13T02:08:58.532Z"}
{"thread":"main","class":"WordPressInstaller","message":"Init WordPressInstaller","level":"info","timestamp":"2021-01-13T02:08:58.675Z"}
{"thread":"main","class":"WordPressInstaller","message":"Starting standardInstall()","level":"info","timestamp":"2021-01-13T02:08:58.675Z"}
{"thread":"main","class":"WordPressInstaller","message":"maybeGetLatestVersion()","level":"info","timestamp":"2021-01-13T02:08:58.676Z"}
{"thread":"main","class":"WordPressInstaller","latestOfflineWpVersion":"5.6","level":"info","message":"Latest offline version info","timestamp":"2021-01-13T02:08:58.676Z"}
{"thread":"main","class":"WordPressInstaller","version":"5.6","download":"https://downloads.wordpress.org/release/wordpress-5.6.tar.gz","level":"info","message":"Latest version info","timestamp":"2021-01-13T02:08:59.326Z"}
{"thread":"main","class":"WordPressInstaller","message":"Configuring wp-config.php","level":"info","timestamp":"2021-01-13T02:09:43.546Z"}
{"thread":"main","class":"WordPressInstaller","message":"Installing WordPress","level":"info","timestamp":"2021-01-13T02:09:44.167Z"}
{"thread":"main","class":"WordPressInstaller","message":"Attempting to delete Akismet and Hello Dolly","level":"info","timestamp":"2021-01-13T02:09:47.172Z"}
{"thread":"main","class":"WordPressInstaller","message":"Writing salts to wp-config.php","level":"info","timestamp":"2021-01-13T02:09:47.889Z"}
{"thread":"main","class":"Process","process":"nginx","pid":19448,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:13:06.656Z"}
{"thread":"main","reason":{},"p":{},"level":"warn","message":"Unhandled Rejection.","timestamp":"2021-01-13T02:27:59.132Z"}
{"thread":"main","class":"Process","process":"mailhog","pid":3672,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.228Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":10572,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.243Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":6808,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.257Z"}
{"thread":"main","class":"Process","process":"nginx","pid":16380,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.271Z"}
{"thread":"main","class":"Process","process":"mysql","pid":17184,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.283Z"}
{"thread":"main","class":"Process","process":"php-adminer","pid":19956,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.296Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2021-01-13T02:28:03.033Z"}
{"thread":"main","class":"Process","process":"nginx","pid":14616,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:03.411Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:03.353704Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 18468","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:03.355797Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:04.282798Z 0 [System] [MY-010229] [Server] Starting crash recovery...","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:04.288274Z 0 [System] [MY-010232] [Server] Crash recovery finished.","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:05.192321Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2021-01-13T02:28:05.219Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:05.218721Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16' socket: '' port: 10041 MySQL Community Server - GPL.","timestamp":"2021-01-13T02:28:05.219Z"}
{"thread":"main","class":"Process","process":"nginx","pid":20024,"level":"info","message":"Killing process","timestamp":"2021-01-13T03:30:43.486Z"}

```

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [January 13, 2021, 6:59pm UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/2 "2021-01-13T18:59:32Z")

</div>

When a multisite is created in Local, there should be an option to “Sync Multi-site Domains to Hosts File”

 ![image](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/1/1fe737cd8a60fcaac82d2b2132129c76c04817cb.png)

Do you see a link like the one pictured above?

---

<div class="post-metadata">

**Author:** ![mulli](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/mulli/32/12287_2.png) [@mulli](https://community.localwp.com/u/mulli)\
**Post date:** [January 14, 2021, 1:10pm UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/3 "2021-01-14T13:10:00Z")

</div>

TRUE! Found it. Mighrated multisite successfully  
BUT only main domain shows  
Since I use subdomains in this WPMU  
and I do not know How to add subdomains for this WPMU.  
Can you help?  
Much appreciated!

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [January 14, 2021, 4:18pm UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/4 "2021-01-14T16:18:40Z")

</div>

Are each of the domains separate domains and not subdomains of the WP network?

Local supports something like this:

```auto
mainsite.local
site1.mainsite.local --> mainsite.local
site2.mainsite.local --> mainsite.local

```

The “Sync Multi-site domains to hosts file” button basically writes those subdomains to the hosts file.

At this time, Local doesn’t have the ability to manage secondary or “add-on” domains like:

```auto
mainsite.local
secondsite.local --> mainsite.local
thirdsite.local --> mainsite.local

```

You “might” be able to manually do this, but I’ve never tried it, so if you get it working, let the community know!

The general flow would be:

1. Edit your hosts file to account for secondary domains
2. Edit the `nginx` configuration for Local’s router so that the domains can be resolved to the correct WP site

Here’s a screenshot to help point the way:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/2/2f2b64bec2c3b8aa96f076eeace0ad4f281b1e1c.png)

Good luck!

---

<div class="post-metadata">

**Author:** ![mulli](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/mulli/32/12287_2.png) [@mulli](https://community.localwp.com/u/mulli)\
**Post date:** [January 14, 2021, 7:35pm UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/5 "2021-01-14T19:35:36Z")

</div>

> [@ben.turner](#):
>
> Sync Multi-site domains to hosts file

Thanks for clarifying the usage of **Sync Multi-site domains to hosts file**  
I activated it and it works great!

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [January 15, 2021, 4:00pm UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/6 "2021-01-15T16:00:09Z")

</div>

Maybe this is obvious, but one other thing I thought of and wanted to clarify – you’ll need to click that button if you add any new subsites as you’re working along.

Since WordPress will “know” about those subdomains, but your computer won’t – clicking that button will update the hosts file so that you can access the sites from the browser.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [April 15, 2021, 4:00pm UTC](https://community.localwp.com/t/how-to-add-subdomain-for-wp-multisite/23867/7 "2021-04-15T16:00:12Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
