Jamie Oliver Posted September 16, 2025 Report Posted September 16, 2025 Hey folks, I’m running into a really odd situation that I can’t figure out. I have Uniform Server set up on Windows 11, and everything works perfectly when I use just one site. But the moment I add a second virtual host, all of my sites, including the first one that was working, start redirecting to the wrong document root. For example, I added a new host pointing to C:/UniServerZ/www/project2, but somehow both localhost/project1 and localhost/project2 now load the same files from project2. Even stranger, if I restart the server a couple of times, it sometimes flips, and both hosts point back to project1 instead. The Apache config looks normal to me, and I double-checked that the hosts file entries are correct. It feels almost like Uniform Server is “forgetting” which virtual host to serve after a restart. Has anyone else seen this kind of behavior? Could it be some hidden caching or a Windows service interfering? I’d love to get to the bottom of this before I break everything even more. Pips NYT Quote
mattewwade06 Posted October 18, 2025 Report Posted October 18, 2025 Hi all This “Programming & Web Design” section is great for sharing and getting help on dev topics. I’m currently working with Uniform Server and I’d love to see more posts focused on integrating PHP frameworks and modern front-end techniques here. Can someone share how they’ve used it for React or Vue in a WAMP setup? Quote
Daniel Kerwosvski Posted Thursday at 10:40 AM Report Posted Thursday at 10:40 AM This is a fairly common gotcha with Apache/Uniform Server on Windows, and it’s usually not caching so much as name-based virtual host configuration order. A few things to check carefully: Ensure NameVirtualHost / default vhost behavior In Apache 2.4 (which Uniform Server uses), Apache serves the first matching virtual host as the default. If one of your <VirtualHost *:80> blocks is missing a unique ServerName (or both are using localhost), Apache can’t reliably decide which one to serve, so it falls back inconsistently after restarts. Each vhost must have a unique ServerName (and optional ServerAlias) Example: <VirtualHost *:80> ServerName project1.local DocumentRoot "C:/UniServerZ/www/project1" </VirtualHost> <VirtualHost *:80> ServerName project2.local DocumentRoot "C:/UniServerZ/www/project2" </VirtualHost> Then map both in your hosts file: 127.0.0.1 project1.local 127.0.0.1 project2.local Avoid using plain localhost for multiple sites localhost should ideally point to one default site only. Using localhost/project1 and localhost/project2 relies on directory routing, not virtual hosts, which can conflict once vhosts are enabled. Check that httpd-vhosts.conf is included only once Duplicate includes or mixed configs can cause Apache to load vhosts in a different order on restart. Restart Apache cleanly (not just reload) Stop Apache completely from UniController, wait a few seconds, then start it again. Windows file locks can sometimes make partial restarts misleading. In short, this behavior almost always comes down to duplicate or missing ServerName entries and Apache picking a different “default” vhost each time. Once each site has its own domain name and matching host entry, the flipping should stop entirely. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.