# Multisite and "localhost" as Router Mode

**URL:** https://community.localwp.com/t/multisite-and-localhost-as-router-mode/25319
**Category:** Support
**Tags:** router-mode, multisite
**Created:** [April 22, 2021, 2:20pm UTC](https://community.localwp.com/t/multisite-and-localhost-as-router-mode/25319 "2021-04-22T14:20:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![LucP](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/lucp/32/12702_2.png) [@LucP](https://community.localwp.com/u/LucP)
#### Post date: [April 22, 2021, 2:20pm UTC](https://community.localwp.com/t/multisite-and-localhost-as-router-mode/25319/1 "2021-04-22T14:20:26Z")

</div>

### Issue Summary

I have created a multisite from scratch and I have encountered an issue related to the router mode being defined on localhost.

The issue occurs when adding a new site.

For instance adding a site with the “subdirectory” URL:

 ![loal-multisite-creation](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/f/f795177adf4d2d96b9d5cf1217a745db85c1dca9.png)

The `:` character in domain is purely dropped:

 ![local-multisite-sites-list](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/1/19d31e48cb346e3e64e50c31bd8eb6894639afb4.png)

If we try to edit it to add `:`, it’s completely dropping the port value to end up with just `http://localhost/subdirectory`.

While searching for an explanation, I’ve found [this post](https://benohead.com/blog/2014/05/30/wordpress-running-multisite-different-port/) saying we can’t use other ports than `:80` or `:443` so I wonder if this couldn’t be related to it.

In any case, it’s not perfect but I’ve found a simple workaround, editing the domain in database this way:

- `siteurl` in `wp_x_options` (where `x` is the id of the site)
- `home` in `wp_x_options` (where `x` is the id of the site)
- `domain` in `wp_blogs` for the corresponding site

#### Troubleshooting Questions

So the question is: is this something expected (I don’t think so) or have you ever encountered this case?

As there is a workaround, this is not blocking hopefully. But it may be nice to cover this case I think. 🙂

#### Replication

- Router Mode with localhost
- Multisite - Subdirectory
- Environment: PHP 7.4 / nginx 1.16 / MariaDB 10.4

#### System Details

I’m not sure this is relevant, but still:

- Local 5.10.3+5332
- Windows 10 Pro

---

<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: [April 22, 2021, 4:09pm UTC](https://community.localwp.com/t/multisite-and-localhost-as-router-mode/25319/2 "2021-04-22T16:09:36Z")

</div>

> [@LucP](#):
>
> While searching for an explanation, I’ve found [this post](https://benohead.com/blog/2014/05/30/wordpress-running-multisite-different-port/) saying we can’t use other ports than `:80` or `:443` so I wonder if this couldn’t be related to it.

That blog post has some great info, and I think that’s exactly what’s causing this issue.

> [@LucP](#):
>
> is this something expected (I don’t think so) or have you ever encountered this case?

I’ve never encountered this, but I’ve never tested this scenario before. Given the info in the above blog post, I would say this is expected behavior since Local’s `localhost` Router Mode is running WordPress on a different port than `80` or `443`.

> [@LucP](#):
>
> As there is a workaround

I don’t think there is a way to get this working under `localhost` router mode. The only workaround would be to get Local to use the “Site Domains” Router mode, which would mean that Local is listening on port `80`/`443` and you wouldn’t be encountering this issue.

---

<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: [July 21, 2021, 4:09pm UTC](https://community.localwp.com/t/multisite-and-localhost-as-router-mode/25319/3 "2021-07-21T16:09:37Z")

</div>

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