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

**URL:** <https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537>\
**Category:** Support\
**Tags:** hosts-file, windows\
**Created:** [October 13, 2023, 5:53pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537 "2023-10-13T17:53:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Owen37](https://avatars.discourse-cdn.com/v4/letter/o/47e85d/32.png) [@Owen37](https://community.localwp.com/u/Owen37)\
**Post date:** [October 13, 2023, 5:53pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537/1 "2023-10-13T17:53:27Z")

</div>

### What issue or error are you experiencing?

I have two urls ([dev.local.sitename.com](http://dev.local.sitename.com) and [dev.local.sitename2.com](http://dev.local.sitename2.com)) configured in my WIndows hosts file as going to 127.0.0.1 and ::1. [dev.local.sitename.com](http://dev.local.sitename.com) is the main url. When I attempt to go to [dev.local.sitename2.com](http://dev.local.sitename2.com), I get redirected to [dev.local.sitename.com](http://dev.local.sitename.com) 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:**  
Latest

- **Operating System (OS) and OS version:**  
Windows

* * *

### Local Logs

Attach your Local Logs here ([Help Doc - Retrieving Local’s Log](https://localwp.com/help-docs/troubleshooting/retrieving-locals-log-file/))

[local-lightning.log](https://community.localwp.com/uploads/short-url/zTRBAnledvIuzXSwEOFXWifmFIA.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.

---

<div class="post-metadata">

**Author:** ![Nick-B](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/nick-b/32/16140_2.png) [@Nick-B](https://community.localwp.com/u/Nick-B)\
**Post date:** [October 13, 2023, 8:12pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537/2 "2023-10-13T20:12:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Owen37](https://avatars.discourse-cdn.com/v4/letter/o/47e85d/32.png) [@Owen37](https://community.localwp.com/u/Owen37)\
**Post date:** [October 13, 2023, 8:55pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537/3 "2023-10-13T20:55:37Z")

</div>

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 [www1.auntminnie.com](http://www1.auntminnie.com) and [www.auntminnieeurope.com](http://www.auntminnieeurope.com), that is exactly what is happening (except they are [asp.net](http://asp.net) websites running on IIS and MSSQL: same code, different configs).

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

TIA,

Owen Mortensen

Senior Software Engineer

Science And Medicine Group

> **[Home](https://www.auntminnie.com)**
>
> AuntMinnie

> **[Home](https://www.drbicuspid.com)**
>
> Dr. Bicuspid

> **[AuntMinnieEurope.com - European Radiology and Imaging News and Education](https://www.auntminnieeurope.com/index.aspx?sec=def)**
>
> AuntMinnieEurope.com is the largest and most comprehensive community Web site for medical imaging professionals worldwide. Radiologists, technologists, administrators, and industry professionals can find information and conduct e-commerce in MRI,...

> **[The Science Advisory Board](https://www.scienceboard.net/index.aspx?sec=def)**
>
> ScienceBoard.net is a community of international scientific professionals working in the life science and medical industries. We provide opportunities for news, research, and collaboration to scientists, laboratory and medical professionals, academic...

> **[Home](https://www.labpulse.com)**
>
> LabPulse.com is an online resource for clinical laboratory professionals.

---

<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:** [October 17, 2023, 4:20pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537/4 "2023-10-17T16:20:54Z")

</div>

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.

> [@Owen37](#):
>
> where are the config files for the web server that Local is using on my machine?

There are at least two “web servers” in play (see this help doc: [What is Router Mode?](https://localwp.com/help-docs/advanced/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`

 ![Image 2023-10-17 at 8.58.17 AM.jpg](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/3X/5/c/5c4fa0935ec234be96619391e40e98bff30f86b8.jpeg)

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!

---

<div class="post-metadata">

**Author:** ![Owen37](https://avatars.discourse-cdn.com/v4/letter/o/47e85d/32.png) [@Owen37](https://community.localwp.com/u/Owen37)\
**Post date:** [October 17, 2023, 10:53pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537/5 "2023-10-17T22:53:04Z")

</div>

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.

Regards,

Owen Mortensen

---

<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:** [October 23, 2023, 2:22pm UTC](https://community.localwp.com/t/configure-local-so-two-urls-go-to-same-site-and-keep-url/39537/6 "2023-10-23T14:22:16Z")

</div>

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