Configure Local so two URLs go to same site (and keep url)

What issue or error are you experiencing?

I have two urls ( and configured in my WIndows hosts file as going to and ::1. is the main url. When I attempt to go to, I get redirected to before wp-config.php is run.

How do I get this redirect to either stop, or wait until after wp-config.php?

I guess the real question is: where are the config files for the web server that Local is using on my machine?

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Create a site. Point two different urls to the site. Only the main site responds and any others redirect to the main site.

System Details

  • Local Version:

  • Operating System (OS) and OS version:

Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

local-lightning.log (718.3 KB)

Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi @Owen37

I’m not sure I understand so apologies here but for clarity are you trying to create a multisite install?

Create a site. Point two different urls to the site. Only the main site responds and any others redirect to the main site.

Why would you need two URLs pointing to the same install?

Actually, no, I’m not trying to create a multisite (that will not do what we need since a multisite uses different tables per site). We need two different URLs to go to the same site and tables and then use php, javascript, and stylesheets to change a few things about the site for branding. Almost all the data will be the same between sites.

If you look at and, that is exactly what is happening (except they are websites running on IIS and MSSQL: same code, different configs).

At any rate, we now have our new WordPress site at and we need to get to share the SAME database (users and other data) and just show a slightly different look (stylesheets, etc) based on the URL.


Owen Mortensen

Senior Software Engineer

Science And Medicine Group

Hey @Owen37 , Local can’t do what you’re describing out of the box. I think the only way you can get something like this to sort of work is roughly like this:

  1. Create a new, plain, Sub-domain multisite (this will create the necessary settings in Local to allow multiple subdomains to reach a specific Local site)
  2. Edit the wp-config.php file for that site and comment out the multisite settings
  3. Manually add the subdomains you want to your hosts file. Note that you’ll need the domains to be subdomains and not two different top-level domains. So dev1.example.local and dev2.example.local would work, but example.local and myexample.local wouldn’t.
  4. Do your site-specific code within the WP site

I haven’t done this, so I don’t know how fragile this is or if the changes get wiped out during updates.

If that doesn’t work, then your other option would probably be to use Local in “localhost” router mode, and then manually spin up your own proxy server to resolve the domains to the individual sites.

But why can’t I just edit…

I don’t think you will be able to edit Local’s default server to get what you need.

There are at least two “web servers” in play (see this help doc: What is Router Mode? for more details), to summarize:

  • Each WP site has one web server (nginx/apache), which listens on an open port (like localhost:10010)
  • The Local router proxies the site’s domain to the individual site’s web server

For what you’re describing, you would need to edit the Local Router’s configuration. That config is found within the user configuration folder, within the run/router sub-folder. Here’s where that is on my Mac. For you on windows, it will be similar, but located in your User folder, under AppData > Roaming > Local

The problem is that there isn’t a way for you to update that file and have it re-loaded into the running Nginx process. Every time Local starts a site, it compiles these configuration files and reloads the nginx process using the values that are set in the Local UI. There isn’t a way to set multiple domains for a regular site within the Local UI.

The reason that creating a multisite within Local might work, is that the nginx config that it uses listens for a wildcard subdomain.

I know this is a rambling reply, but hopefully it gets you something you can use. Let us know if you have any other questions!

1 Like

Thank you for the detailed reply. Due to the complexity (and probably unstable) of the solutions, we’re probably going to find another way to specify which “branding” should appear on the site as a user navigates through it with just the one domain.


Owen Mortensen

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