Multisite and "localhost" as Router Mode

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:

The : character in domain is purely dropped:
local-multisite-sites-list

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 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. :slight_smile:

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

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

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.

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.

2 Likes

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