If a domain shows Apache’s default page, the wrong site, or a different result over HTTPS, changing DocumentRoot may not be the fix. The request must first resolve to the right server, arrive on the expected IP and port, match the correct ServerName/ServerAlias, and only then map to that virtual host’s filesystem directory.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
How Apache decides which directory to serve
A browser request passes through several independent decisions:
As an Amazon Associate I earn from qualifying purchases.
- DNS resolution: the domain and aliases resolve to an IP address. Apache configuration does not create DNS records.
- Listener selection: the connection reaches a destination IP and port, normally 80 for HTTP or 443 for HTTPS.
- Virtual-host matching: Apache compares the request’s
Hostvalue withServerNameandServerAliasin virtual hosts attached to that IP and port. - Filesystem mapping: the selected host’s absolute
DocumentRootis combined with the URL path. - Directory handling: when the path is a directory such as
/, Apache usesDirectoryIndexto find an index file.
A failure at an earlier layer can make a correct directory setting appear broken. A default page usually indicates that the request did not match the intended host at all. A 404 or 403 after the right host is selected points to the path, permissions, or application instead.
Identify the exact symptom before changing configuration
| What you see | Most likely layer | First check |
|---|---|---|
| Apache default page | DNS, IP/port, Host matching, or vhost load order | Resolve the name, then inspect apachectl -S and aliases |
| Another site’s branded page | Request selected a different virtual host | Compare the destination IP, port, hostname, and first vhost for that address |
| 404 from the expected site | Correct vhost, wrong path or application route | Check DocumentRoot, file existence, and URL routing |
| 403 Forbidden | Correct vhost, but access or filesystem permissions prevent reading | Check directory permissions, access rules, and the error log |
| HTTP works but HTTPS does not | Port-443 vhost, certificate, or TLS alias problem | Inspect the separate *:443 configuration |
| Domain works locally but not for others | Local hosts-file override or DNS propagation | Compare public DNS with the client’s hosts file |
1. Verify DNS before editing Apache
Resolve the apex name and every alias you expect users to visit. Check both the bare domain, such as example.com, and www.example.com; subdomains require their own records as well. Compare each returned address with the server’s public IPv4 and IPv6 addresses.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
For a quick check from a terminal, query the records directly:
dig +short example.com A
dig +short example.com AAAA
dig +short www.example.com A
dig +short www.example.com AAAA
On systems without dig, nslookup example.com provides the same basic visibility. An A record points to IPv4, an AAAA record to IPv6, and a CNAME aliases one name to another. A stale, misspelled, or unintended record can send the browser to a different server even when Apache is configured perfectly.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
If a record is wrong, correct it at the DNS provider and wait for the record’s TTL. Different resolvers may continue returning the old value until that cache lifetime expires. Apache’s own virtual-host examples make the boundary explicit: creating a virtual-host configuration does not automatically create DNS entries for those host names.
A hosts-file entry is useful only for local testing. Add the server IP and name to the hosts file on the particular client machine, make the request, and remove the entry after testing. It does not publish the name for colleagues, customers, mobile devices, or public DNS resolvers.
2. Confirm the request reaches the intended IP and port
Apache chooses among virtual hosts associated with the connection’s destination IP and port. A working *:80 block cannot repair a missing or conflicting *:443 block. Likewise, a domain that resolves to an old server will never reach the configuration you just edited.
- Test HTTP at
http://example.com/and HTTPS athttps://example.com/separately. - Confirm that the DNS answer for each name is the address assigned to this server.
- Check that Apache is listening on the expected interfaces and ports according to the host’s service configuration.
- If a proxy, load balancer, CDN, NAT device, or firewall sits in front of Apache, verify that it forwards the request to the intended backend and preserves the hostname.
An IP-address request is not an equivalent test for a domain request. When you browse to an IP, the browser sends that IP as the host name, so Apache may deliberately select the default virtual host. Always test with the real domain in the URL or set the intended Host header in a controlled command-line test.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
3. Make the hostname match exactly
Every name users enter must be represented in the virtual host. Put the primary name in ServerName and additional accepted spellings in ServerAlias. Apache’s name-based-host documentation requires, at minimum, a ServerName identifying the host and a DocumentRoot identifying its content directory.
<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>
The comparison is based on the hostname in the HTTP Host value. A missing www alias, a typo, an unexpected trailing name, or a request sent to a different port can therefore select another host. Decide whether both the apex and www should serve the same content or whether one should redirect to the other, then configure that behavior deliberately.
Do not assume that a wildcard or a similarly spelled name covers every case. List each required alias explicitly and check spelling, punctuation, and the domain’s actual public suffix.
4. Configure HTTPS independently
HTTPS normally uses a separate virtual-host block attached to port 443. It needs the certificate and key directives required by your Apache installation, the intended hostname aliases, and an intentional content or redirect policy.
Free tools Windows power users keep installed
One-click scans. No signup required.
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
SSLEngine on
# Certificate directives for your installation go here.
DocumentRoot /var/www/example
ErrorLog ${APACHE_LOG_DIR}/example-ssl-error.log
CustomLog ${APACHE_LOG_DIR}/example-ssl-access.log combined
</VirtualHost>
Keep the HTTPS DocumentRoot aligned with the HTTP site when both protocols should serve the same application. If HTTPS should redirect elsewhere, make that redirect explicit. Otherwise a request can work on port 80 and show a default or unrelated site on port 443.
Check certificate coverage as well as content selection. A certificate for only the apex name does not automatically cover www; the certificate’s names and the vhost’s aliases must agree.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
5. Validate what Apache actually loaded
Editing a file does not prove Apache read it. Test syntax first, then inspect Apache’s parsed virtual-host map:
sudo apachectl -t
sudo apachectl -S
On Windows, use the equivalent executable command:
httpd.exe -S
The syntax test should report that the configuration is valid. Do not reload a configuration that fails this test. The -S output shows the addresses and ports Apache recognized, the order of name-based hosts, and the source files associated with them. Use it after every virtual-host change.
Confirm all of the following in the output:
- The intended configuration file appears in the parsed map.
- The host is attached to the correct address and port, especially 443 for HTTPS.
- The expected
ServerNameand aliases are present. - No earlier virtual host is claiming the same name and address.
- The active configuration is the file you edited, not a similarly named copy in another directory.
If your distribution uses a separate “sites available” and “sites enabled” arrangement, make sure the file is enabled according to that distribution’s procedure. The exact enablement command differs by platform; the parsed -S output is the reliable proof that Apache loaded the result.
6. Understand why the default site appears
For a given address and port, Apache uses the first name-based virtual host when no configured ServerName or ServerAlias matches the request hostname. That first host is effectively the default for unmatched requests.
Consequently, the default page does not necessarily mean the default site’s directory is wrong. It can mean:
- DNS sent the browser to another server.
- The site file was never loaded.
- The request used an alias that is absent from
ServerAlias. - The request arrived on 443 while only port 80 was configured.
- An earlier virtual host for the same address and port is being selected.
- A proxy or load balancer changed the destination or hostname before Apache received it.
Changing the first site’s DocumentRoot may hide the symptom while leaving the hostname-matching problem unresolved. Fix the layer that is actually failing.
Recommended Free Tools
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
7. Separate virtual-host selection from filesystem mapping
Once Apache has selected a host, it appends the URL path to that host’s absolute DocumentRoot. With DocumentRoot /var/www/example, a request for /images/logo.png maps to /var/www/example/images/logo.png.
For a request to /, Apache checks the filenames listed by DirectoryIndex, commonly an index HTML or PHP file. Verify that:
- The configured root directory exists at the exact absolute path.
- The expected index file is inside that directory.
- Subdirectories and files have names and capitalization matching the URL on case-sensitive systems.
- The account running Apache can traverse the directories and read the files.
- Application rewrite rules are present if the site depends on front-controller routing.
A 404 after the correct vhost is selected usually means the requested path is absent or the application generated the response. A 403 usually means access controls or permissions blocked the request. Neither status is fixed by adding another DNS record.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.8. Use logs and a deliberately bad URL
Watch the selected virtual host’s access and error logs while making a request. The sample configuration above gives each site separate log files, which makes it easier to see whether the request reached the expected host.
Apache’s troubleshooting guidance recommends requesting a path that is guaranteed not to exist. Use a unique marker such as:
https://example.com/this-path-must-not-exist-9f3c2
Then locate the resulting 404 in the logs. The log file that records it identifies which virtual host handled the request. If the marker appears in another site’s log, return to DNS, port, alias, and vhost ordering rather than changing the intended site’s directory.
Best Value
For temporary diagnostics, you can place a uniquely named test file or response marker in the intended root. Remove it as soon as the test is complete; diagnostic files should not remain publicly accessible.
Common failure cases and precise fixes
The apex works, but www shows the default page
Check that www.example.com resolves to the same intended address and that www.example.com appears in ServerAlias on both the HTTP and HTTPS hosts. If the design is canonical-apex-only, configure an explicit redirect instead of relying on an unmatched-host fallback.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteHTTP serves the right directory, HTTPS serves another site
Inspect the *:443 entries in apachectl -S. Add or correct the HTTPS ServerName, aliases, certificate settings, and DocumentRoot or redirect. Test the HTTPS name directly after validating syntax.
The domain resolves to an old server
Compare public A and AAAA responses with the current server’s addresses. Correct stale records, account for the record TTL, and retest from a resolver that is not using the old cache. A local hosts-file override can make one computer appear fixed while public visitors still reach the old address.
The new configuration file is ignored
Run apachectl -t and apachectl -S. If the file is absent from the parsed map, it is not enabled, is outside the active include set, or Apache is using a different configuration tree than the one you edited. Enable or include it using your platform’s documented method, then validate again before reloading.
The right site answers, but the home page is a 404
Use the parsed vhost map and logs to confirm selection first. Then inspect the absolute DocumentRoot, the index file named by DirectoryIndex, URL capitalization, and application rewrite rules. Do not add another virtual host until those filesystem and routing checks are complete.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsThe right site answers, but every request is 403
Read the vhost error log for the specific denial. Confirm that Apache can traverse every parent directory and read the requested files, and review any directory access rules. Correct permissions and access policy without making the entire filesystem broadly writable.
A repeatable diagnostic workflow
- Write down the exact URL, protocol, hostname, and observed status or page.
- Resolve the apex,
www, and relevant subdomains; compare every result with the intended server address. - Check HTTP and HTTPS independently because they use different ports and may select different hosts.
- Verify
ServerNameand every requiredServerAliascharacter for character. - Run
sudo apachectl -t(orhttpd.exe -twhere applicable), correcting errors before any reload. - Run
sudo apachectl -Sorhttpd.exe -Sand confirm file, address, port, alias, and ordering. - Confirm the selected host’s absolute
DocumentRoot, index file, and read/execute permissions. - Make a request for a unique nonexistent path and identify the handling vhost from its logs.
- Reload Apache only after validation, then retest with the real hostname rather than the server IP.
When to involve the DNS or hosting administrator
You need DNS-provider access to change A, AAAA, and CNAME records. You need server access to change Apache virtual hosts, reload the service, and read logs. If you control only one side, provide the administrator with the exact hostname, protocol, destination IP, timestamp, status code, and the output relevant to the failing layer. A managed service can perform those changes, but the separation still matters: no hosting provider can make a wrong public DNS record select your server, and no DNS edit can repair an invalid Apache configuration.
Quick Recap
Final verification checklist
- Every public name resolves to the intended server address.
- HTTP and HTTPS each have an intentional virtual host.
ServerNameis the canonical name and all accepted alternatives are listed as aliases.- The intended configuration appears in
apachectl -Sorhttpd.exe -S. - The syntax test passes before reload.
- The selected host has the correct absolute
DocumentRootand expectedDirectoryIndexfile. - Apache’s account can read the content and traverse its parent directories.
- Access and error logs show the request in the intended vhost.
- A deliberately nonexistent URL produces a logged 404 in that same vhost.
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.




