Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
If www.example.com opens your site but example.com shows a default page or another website, fix the problem in this order: verify DNS, declare the apex hostname in the virtual-host configuration, confirm the listener address and port, inspect the parsed configuration, then test HTTPS and logs separately. DNS only gets the request to a server; Apache or Nginx still has to match the requested hostname to the correct virtual host.
The root or apex domain (example.com) and its www hostname are different names. When the apex name is missing, unmatched traffic is normally handled by a default or first-listed virtual host, which explains why the server responds but the wrong site appears.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11What a root-domain virtual-host failure means
A browser request passes through more than one decision point:
- DNS resolution: the hostname must resolve to the server address that should receive the request.
- Listener selection: the web server must be listening on the IP address and port reached by the request, such as port 80 for HTTP or 443 for HTTPS.
- Hostname matching: Apache or Nginx compares the requested hostname with the names declared in its virtual-host configuration.
- Content and application handling: after a virtual host is selected, its document root and application rules serve the response.
A virtual-host file cannot create DNS records. Apache’s documentation makes this explicit: “Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names.” A hosts-file entry can make a name resolve, but only on the machine where that entry exists; it does not publish the name for other users.
#1 Best Overall
Because the apex and www names are separate hostnames, listing only one of them is a common cause of this symptom. The server may be healthy and the site files may be correct while the request still lands in another virtual host.
Recognize the symptom before changing files
| What you see | Most likely point of failure | First check |
|---|---|---|
| The domain does not resolve or times out | DNS record, delegation, firewall, or listener | Query the apex A and AAAA records and verify the returned addresses belong to this server. |
The apex opens a distribution default page, while www works |
The apex name is absent from the matching virtual host, or DNS sends it elsewhere | Check the apex DNS result, then inspect ServerName/ServerAlias or server_name. |
| The apex opens another customer’s site on the same server | No hostname matched, so fallback ordering selected another virtual host | Inspect the parsed configuration and the first/default host for that address and port. |
| HTTP is correct but HTTPS opens the wrong site | The port-443 configuration, certificate names, or TLS SNI selection is wrong | Check the HTTPS server block and certificate coverage for both names. |
| A local test works but another network does not | A hosts-file override or split DNS is masking the public DNS problem | Compare public DNS answers with the local hosts file and test from an independent network. |
Step 1: Verify DNS for the apex and alternate hostname
Before editing Apache or Nginx, confirm that both names resolve to the intended machine. Replace example.com with your actual domain:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsdig +short example.com A
dig +short example.com AAAA
dig +short www.example.com A
dig +short www.example.com AAAA
An A record should return the server’s IPv4 address. If you use IPv6, the AAAA record must return an IPv6 address on which the web server is configured to listen. A stale or incorrect AAAA record can send some clients to a different machine even when the A record is correct. If you do not have dig, use an equivalent DNS query tool such as nslookup.
Check the record type you actually use
- The apex commonly has an A record and, where applicable, an AAAA record.
wwwmay use its own A/AAAA records or a CNAME, but the final address still needs to reach the web server that has the virtual host.- If the DNS provider has separate records for different regions or networks, verify that every returned address is configured consistently.
Do not treat a hosts-file edit as a public DNS fix. It is useful for a controlled local test, but it changes name resolution only on that one computer.
Step 2: Declare the apex name explicitly
Each hostname that should serve the site must be included in the virtual-host definition. You can make the apex the primary name and add www as an alias, or list both names in the same Nginx server block.
Apache HTTP Server
An Apache name-based virtual host needs at least a ServerName and a DocumentRoot. Add the alternate hostname with ServerAlias:
Free tools Windows power users keep installed
One-click scans. No signup required.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example
ErrorLog ${APACHE_LOG_DIR}/example-error.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
</VirtualHost>
ServerName identifies the canonical name for this host. ServerAlias adds other names, including the common www hostname or additional names that should resolve to the same content. The path in DocumentRoot must be the directory that actually contains this site’s files.
Rank #2
Nginx
Nginx uses the server_name directive to select a server block. Put both exact names in the same block when they are intended to serve the same site:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example;
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
}
Nginx supports exact, wildcard, and regular-expression names. Use exact names for the apex and www unless you deliberately need wildcard behavior; a broad wildcard can capture traffic that should go to another site.
Step 3: Confirm the IP and port binding
Apache first groups virtual hosts by the most specific matching IP-address and port combination. Only then does it compare the request hostname with ServerName and ServerAlias. A correctly written name can therefore appear not to work if the request arrives on an address or port that the virtual host does not cover.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Check the HTTP listener
- Use
*:80when the host should answer on every local IPv4 address, or specify the exact local address when intentional address-based hosting is required. - For IPv6 traffic, configure an IPv6 listener as well; an IPv4-only binding does not receive requests sent to an AAAA address.
- Make sure the daemon is actually listening on port 80. A firewall, container port mapping, load balancer, or reverse proxy may terminate or forward traffic before it reaches Apache or Nginx.
For HTTPS, repeat the same reasoning for port 443. An HTTP virtual host on port 80 does not control an HTTPS request that arrives on port 443.
Check for address-specific conflicts
If one virtual host uses an explicit address such as 192.0.2.10:80 and another uses *:80, Apache’s address-and-port grouping can produce a result different from what a quick file inspection suggests. Make the binding intentional and consistent across the sites that share the server.
Step 4: Validate and inspect the loaded configuration
Editing a file is not the same as loading it. First validate syntax, then inspect the configuration that the running server will use.
Apache commands
apachectl configtest
apachectl -S
On Windows, the equivalent configuration dump is:
httpd.exe -S
apachectl -S reports how Apache parsed the virtual hosts, including their addresses, ports, server names, aliases, and ordering. Use it to find a misspelled name, a duplicate name, a virtual host attached to the wrong port, or an old file that is still enabled. The output also reveals which host is first for a given address and port.
After a successful syntax test, reload Apache using the service mechanism for your operating system. A reload applies the changed configuration without unnecessarily terminating active connections; use the service manager’s reload action rather than assuming a distribution-specific command.
Nginx commands
nginx -t
nginx -T
nginx -t checks syntax and referenced files. nginx -T prints the complete configuration as Nginx sees it, including files pulled in through include. Search that output for the apex name, the www name, listen 80, and listen 443. Reload Nginx only after the test succeeds.
Why parsed output matters
Default-site files, automatically generated snippets, and duplicate definitions can make the effective configuration differ from the file you just edited. If the parsed output does not contain the apex name on the expected address and port, changing the document directory will not fix routing; correct the loaded configuration first.
Step 5: Understand the default-site symptom
An unmatched hostname does not usually produce an obvious “virtual host missing” error. It is handled by a fallback.
For Apache, if no ServerName or ServerAlias matches among the virtual hosts on the most specific address and port, Apache uses the first listed virtual host that matches that address and port. Apache’s documentation states: “If no matching ServerName or ServerAlias is found in the set of virtual hosts containing the most specific matching IP address and port combination, then the first listed virtual host that matches that will be used.”
For Nginx, an unmatched Host name is routed to the default server for that port. The result can be a distribution welcome page, an administrator’s site, or another customer’s site even though DNS correctly points to the machine.
Make fallback behavior deliberate
Do not rely on whichever file happens to load first. Give every production hostname an explicit match. You can also configure a deliberate default that rejects unknown names or serves a neutral response, but that does not replace declaring the apex and www names in the intended site.
Rank #4
Step 6: Configure HTTPS as a separate hostname-and-port match
HTTPS has an additional selection step. During the TLS handshake, the client sends the requested name through Server Name Indication (SNI). Nginx can select a server configuration from SNI before it processes the HTTP Host header. Consequently, HTTP can work while HTTPS selects another site’s certificate or content.
Apache HTTPS example
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example
SSLEngine on
SSLCertificateFile /etc/ssl/example/fullchain.pem
SSLCertificateKeyFile /etc/ssl/example/privkey.pem
ErrorLog ${APACHE_LOG_DIR}/example-ssl-error.log
CustomLog ${APACHE_LOG_DIR}/example-ssl-access.log combined
</VirtualHost>
The exact certificate directives can differ by Apache version and operating-system package, but the important routing details are the *:443 binding and the same apex and alternate names. The certificate presented for this host must cover every name users will enter, normally through its subject-alternative names.
Nginx HTTPS example
server {
listen 443 ssl;
server_name example.com www.example.com;
root /var/www/example;
ssl_certificate /etc/ssl/example/fullchain.pem;
ssl_certificate_key /etc/ssl/example/privkey.pem;
access_log /var/log/nginx/example-ssl.access.log;
error_log /var/log/nginx/example-ssl.error.log;
}
Check that the HTTPS block is enabled and that no earlier or explicitly designated default server on port 443 captures the request. If the certificate does not include the apex name, browsers may stop with a certificate warning before your application can respond; fixing only the HTTP block cannot solve that.
Test both encrypted names
curl -I https://example.com
curl -I https://www.example.com
Compare the certificate name, status code, redirect target, and response headers. A redirect from the apex to www is fine when intentional, but the initial TLS handshake still has to select a certificate valid for the name the user entered.
Step 7: Verify routing with controlled requests
Use requests that identify the hostname explicitly so you can separate DNS from virtual-host matching.
Recommended Free Tools
Test the public path
curl -I http://example.com
curl -I http://www.example.com
curl -I https://example.com
curl -I https://www.example.com
Run these after DNS has propagated to the intended addresses. Record the status code, Location header, server header if present, and whether the body is your site or a default page.
Test a specific server address without changing DNS
curl --resolve lets you send a request to a chosen address while retaining the hostname used for virtual-host and TLS selection:
Best Value
curl -I --resolve example.com:80:192.0.2.10 http://example.com/
curl -I --resolve example.com:443:192.0.2.10 https://example.com/
Replace 192.0.2.10 with the server address. If this works but the ordinary request does not, DNS or an upstream proxy is the likely difference. If it still returns the wrong site, focus on the loaded virtual-host and listener configuration.
Force a known missing path
A homepage can be generated by a shared application and may hide which virtual host handled it. Request a path that should not exist, such as /__vhost_probe_404__, and then inspect the access and error logs. The expected status is normally 404; the log in which the request appears identifies the selected virtual host.
Step 8: Use per-virtual-host logs to prove the match
Give each site its own access and error logs whenever possible. Then send a request with a distinctive path and timestamp:
curl -i http://example.com/__vhost_probe_404__
Check which site’s access log records the request and whether its error log reports the expected missing resource. This verifies routing independently of the application’s normal homepage. If no site log records the request, it may be stopping at a load balancer, firewall, container proxy, or a listener on another address.
Interpret the result
- The intended log records it: virtual-host matching works; investigate document-root permissions, rewrites, or application behavior.
- Another site’s log records it: the hostname is unmatched or the request is reaching a different address-and-port group.
- No relevant log records it: inspect DNS, firewall rules, proxy forwarding, and listener bindings before changing site content.
Common failure branches and precise fixes
The apex fails but www works
- Query the apex A and AAAA records and compare them with the records for
www. - Add the apex to Apache’s
ServerNameorServerAlias, or to Nginx’sserver_name. - Confirm the name appears under the correct port in
apachectl -Sornginx -T. - Retest HTTP and HTTPS independently.
Both names resolve, but the default page appears
DNS is reaching a server, but no configured name matched. Check for a typo, an unenabled configuration file, a duplicate definition, or a listener mismatch. The fallback order explains the default page; changing the default page’s files does not repair the hostname match.
Only some users reach the wrong site
Compare IPv4 and IPv6 answers. If the AAAA record points to an older server, IPv6-capable clients can consistently see a different virtual-host configuration while IPv4 users see the intended site. Correct the AAAA record or configure the IPv6 listener and virtual host on the address it returns.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →HTTP is correct, HTTPS is wrong
Inspect the port-443 blocks rather than the port-80 block. Confirm SNI-related name matching, certificate coverage for both names, and the order or default designation of HTTPS servers. Test with curl over HTTPS and inspect the per-site SSL logs.
A local browser works after editing the hosts file
Remove or account for the local override when validating the public service. Query DNS from another network and use a device that does not contain the override. A hosts-file result proves only that the local machine was sent to the address you specified.
Apache and Nginx: the same diagnosis, different controls
| Diagnostic concern | Apache | Nginx |
|---|---|---|
| Hostname directive | ServerName for the primary name and ServerAlias for additional names. |
server_name with exact, wildcard, or regular-expression names. |
| Address and port | <VirtualHost address:port>, grouped by the most specific matching address and port. |
listen directives determine the address and port for each server block. |
| Unmatched request | First listed virtual host for the matching address and port. | Default server for the port. |
| Configuration inspection | apachectl -S on Unix-like systems; httpd.exe -S on Windows. |
nginx -T to print the loaded configuration, after nginx -t passes. |
| HTTPS selection | Use a port-443 virtual host with the same names and a certificate covering them. | Use a port-443 server block with the same names; SNI can select it before the HTTP Host header is processed. |
| Routing proof | Separate ErrorLog and CustomLog files for each virtual host. |
Separate access_log and error_log files for each server block. |
The root-domain troubleshooting sequence is therefore the same on both servers: DNS, listener, hostname match, HTTPS/SNI, then logs. The directives and inspection commands differ, but a default page generally means the request reached a server without matching the intended name.
Final verification checklist
- The apex A and, if used, AAAA records resolve to the intended server address.
- The
wwwrecords resolve consistently with the chosen hosting design. - Apache contains the apex in
ServerNameorServerAlias, or Nginx contains both names inserver_name. - The HTTP virtual host listens on the address and port that receive traffic.
- The HTTPS virtual host listens on port 443 and lists the same names.
- The certificate presented over HTTPS covers the apex and every alternate hostname users enter.
- Configuration tests pass, and the parsed configuration shows the expected names, ports, and ordering.
- Requests to a distinctive nonexistent path appear in the intended virtual host’s logs.
- Tests from outside any local hosts-file override return the same result over both HTTP and HTTPS.
Once these checks pass, a remaining wrong page is no longer a root-domain virtual-host selection problem; investigate the selected site’s document root, rewrite rules, proxy configuration, or application routing.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

