Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Set Up Multiple Domain Aliases on a Web Server

Learn how to point several domains at one website, configure Apache or NGINX aliases, secure every hostname with HTTPS, choose canonical redirects and diagnose wrong virtual-host responses.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To point several domain names at one website, configure two separate layers: DNS must send every hostname to the server, and the web server must recognize those hostnames. Apache matches aliases with ServerName and ServerAlias; NGINX lists them in server_name. For HTTPS, the certificate presented for each connection must include every hostname users can enter.

How domain aliases work

A domain alias is an additional hostname that serves the same application or document root as a primary domain. For example, example.com, www.example.com, example.net and www.example.net can all reach one site. The browser sends a hostname with its request; the server uses that hostname to select a virtual host or server block.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DNS and web-server configuration are independent. A virtual-host file does not create DNS records, and a DNS record does not tell Apache or NGINX which site should answer. Both layers must be correct before an alias works.

The request path

  1. The visitor enters a hostname in a browser.
  2. DNS resolves that hostname through an A, AAAA or permitted CNAME record.
  3. The connection reaches an IP address on the server.
  4. For HTTP, Apache or NGINX examines the Host header. For HTTPS, TLS SNI helps select the certificate and virtual server before the encrypted HTTP request is processed.
  5. The selected configuration serves the site or redirects the request to a canonical hostname.

Decide what each alias should do

Choose the behavior before adding names. Most deployments use one of two policies.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [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.

Redirect aliases to one canonical domain

Legacy domains, spelling variants and branding alternatives commonly issue a permanent redirect to one preferred hostname. The browser then displays the canonical address, while search engines and bookmarks converge on one URL structure. The redirect must be configured after the alias can reach the server, and HTTPS still has to work for the alias because the browser establishes TLS before it can follow an HTTPS redirect.

Serve the same site on every hostname

If each alias remains visible in the address bar, the application must be host-aware. Check absolute links, canonical tags, cookie scope, CORS rules, password-reset URLs, email links and any callback or payment URLs. A page can load correctly while generating links to the wrong domain if the application assumes only one host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure DNS for every hostname

Create a DNS record for each name that users will request, including both the bare domain and the www name when both are public. Point the records to an address on the web server or to the service that forwards traffic to it.

Record Use Important check
A Maps a hostname to an IPv4 address. Use the server’s reachable public IPv4 address.
AAAA Maps a hostname to an IPv6 address. Only publish it when the server and firewall correctly serve the site over IPv6.
CNAME Points a name to another DNS name where the DNS design permits it. Follow the DNS provider’s rules for the zone apex and for chained records.

DNS changes may be visible at different times because resolvers cache records according to their TTL. Verify the result from the server or an external resolver before changing web-server rules. Examples are:

dig +short example.com A
dig +short example.com AAAA
dig +short www.example.net CNAME
nslookup example.net

Every public alias should resolve to the intended service. If one name resolves to an old address, the web server cannot fix that mismatch.

Set up multiple aliases in Apache

Apache name-based virtual hosting lets one VirtualHost answer for several names. Put the main hostname in ServerName and alternate hostnames in ServerAlias.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Create the HTTP virtual host

Edit the site’s existing virtual-host file, or create a new one using the layout required by your operating system. This example serves all four names from one document root:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【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.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com example.net www.example.net
DocumentRoot /var/www/example

<Directory /var/www/example>
Require all granted
</Directory>
</VirtualHost>

ServerName identifies the canonical host for the block. Each additional name must be written in ServerAlias; separating names with spaces is valid. Do not assume that putting a name in a comment, a filesystem directory or an application setting creates an Apache alias.

2. Enable the site and validate Apache’s view

Enable the virtual-host file using your distribution’s site-management method, then check the configuration syntax and reload Apache. On systems that provide the Apache helper, inspect the parsed mapping with:

apachectl configtest
apachectl -S

apachectl -S lists the addresses, ports and virtual hosts Apache recognized. Use it to confirm that every intended alias appears in the expected *:80 block. Reload only after the syntax check succeeds; a reload applies the new configuration without requiring a full machine reboot.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Add the HTTPS virtual host

Create a corresponding *:443 block. It must contain the same public names and the TLS certificate settings used by your deployment:

<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com example.net www.example.net
DocumentRoot /var/www/example
SSLEngine on
SSLCertificateFile /path/to/fullchain.pem
SSLCertificateKeyFile /path/to/private-key.pem
</VirtualHost>

The certificate selected for this connection must list every hostname users may request. Install the complete certificate chain in the location expected by your Apache build, protect the private key, validate the configuration, and reload Apache again.

How Apache chooses a host

Apache first considers the listening address and port, then compares the requested hostname with ServerName and ServerAlias. If nothing matches, Apache uses the first listed virtual host for that address and port. Consequently, file order can determine which site receives an unknown or misspelled hostname. Keep an intentional default virtual host first, or create an explicit catch-all policy that rejects or redirects unexpected hosts.

Set up multiple aliases in NGINX

NGINX places all exact aliases for one site in the same server block by listing them in server_name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [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

1. Create the HTTP server block

server {
listen 80;
server_name example.com www.example.com example.net www.example.net;
root /var/www/example;

index index.html index.htm;
}

The names are space-separated. Add the block in the configuration location used by your installation, include it from the main http context when necessary, and make sure the root and any proxy settings point to the intended application.

2. Use wildcards only for deliberate patterns

NGINX accepts exact names, wildcard names and regular-expression names. An intentional wildcard such as *.example.com can cover a family of subdomains, but it is not equivalent to listing the bare domain. Keep exact names explicit when only a known set of aliases should work. NGINX applies defined precedence rules when exact, wildcard and regular-expression names overlap, so avoid overlapping patterns unless you have a clear reason and have tested the result.

3. Add the HTTPS server block

server {
listen 443 ssl;
server_name example.com www.example.com example.net www.example.net;

ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/private-key.pem;
root /var/www/example;
}

Use the current TLS directives supported by your NGINX version or deployment. The certificate must cover every name in this block that can appear in a browser address bar. If your configuration uses separate HTTP and HTTPS blocks, keep the public names synchronized.

4. Test and reload NGINX

Validate the complete configuration before applying it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
nginx -t
systemctl reload nginx

If your system does not use systemctl, use its service manager’s equivalent reload operation. A successful syntax test confirms that NGINX can parse the files; it does not prove DNS, certificate coverage or application-generated links are correct.

How NGINX chooses a server block

NGINX can use the TLS SNI name during the handshake and then the HTTP Host header after encryption is established. It compares the request with the server_name values associated with the matching listening address and port. Multiple server directives can coexist in the http context, each serving a different site or name set. If a request does not match the names you intended, it can fall through to the default server for that address and port.

Make HTTPS work for every alias

HTTPS is a hostname-by-hostname requirement. A browser may reject a connection before it ever receives your redirect if the certificate does not contain the requested name.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • 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.

Certificate coverage

A multi-name certificate can list unrelated domains such as example.com and example.net, along with their www names. Confirm that every public hostname appears in the certificate’s subject alternative names. The certificate and private key must also be installed in the TLS virtual host or server block selected for that name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wildcard limits

A wildcard certificate covers one subdomain level only. *.example.com covers names such as www.example.com, but it does not cover the bare example.com and does not cover a deeper name such as a.b.example.com. List those names separately or obtain certificate coverage that includes them.

SNI and shared addresses

Server Name Indication allows multiple HTTPS virtual servers to share one IP address. The client sends the requested name during the TLS handshake, allowing the server to select an appropriate certificate and configuration. SNI does not remove the need for correct DNS, matching server names or a certificate that includes the requested hostname.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose redirects or same-host serving safely

Permanent redirect design

For a canonical policy, configure each alias to return a permanent redirect to the preferred scheme, hostname and path. Preserve the path and query string unless you intentionally change them. Test both HTTP and HTTPS forms of every alias, because an HTTP-only rule cannot help a browser that fails certificate validation on an HTTPS request.

Serving identical content on multiple names

When aliases remain active, inspect the application rather than only the web-server response. Absolute URLs in templates, canonical metadata, cookies, CORS allowlists, password-reset messages and API callbacks may embed one hostname. Decide whether those values should follow the requested host or always use the canonical host, and configure them consistently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate each alias from the outside

Use a repeatable sequence so that a DNS problem is not mistaken for a virtual-host problem.

  1. Resolve the name. Query the A and, when published, AAAA records. Confirm that the answer is the intended server address.
  2. Check the parsed web-server configuration. Run apachectl -S for Apache, or nginx -t and inspect the loaded server blocks for NGINX.
  3. Send the intended host header. From a machine that can reach the server, test the address while specifying the hostname, for example:
    curl -I -H 'Host: example.net' http://SERVER_IP/
  4. Test TLS by hostname. Open each HTTPS alias in a browser or use a TLS client that sends the name through SNI. Confirm the certificate name, chain and selected site.
  5. Read access and error logs. Look for the requested host, unexpected default-vhost responses, redirect loops, certificate errors and application-generated links pointing elsewhere.
  6. Repeat after propagation. Test from more than one resolver or network when DNS records were recently changed, because cached answers can differ during the TTL period.

Fix the most common failures

The alias resolves, but the wrong website appears

Check that the hostname is spelled identically in DNS and in ServerAlias or server_name. Then inspect Apache’s apachectl -S output or NGINX’s active configuration. An unmatched request often reaches the first or default virtual server for that address and port, which makes the symptom look like a DNS failure even when DNS is correct. Correct the name list or the default-server strategy, then reload.

One alias works and another times out

Compare the DNS records, including IPv4 and IPv6. An incorrect AAAA record can send IPv6-capable clients to a host that is not serving the site while IPv4 tests succeed. Remove or correct an unusable address, and verify firewall and listener coverage for every published address.

HTTP works but HTTPS shows a certificate warning

The TLS certificate selected for that hostname is missing the name, or the wrong HTTPS virtual host is being selected. Add the hostname to the certificate and the *:443/port-443 name list, install the resulting certificate and reload the service. A redirect cannot repair a certificate mismatch that happens before HTTP is available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The certificate is valid but the wrong content loads

SNI may select a certificate while the later HTTP hostname match selects a different server block, or the names may be split between blocks unintentionally. Keep each site’s public names together where appropriate and test the HTTPS request with the exact hostname.

Redirects loop between aliases

Inspect both the web-server rules and application URL settings. A proxy or application may believe the request is HTTP, or one layer may redirect to a hostname that redirects back. Trace the Location response for each scheme and hostname, then define one canonical destination and one rule path.

Operational checklist

  • List every hostname that may appear in a link, bookmark, certificate request or browser address bar.
  • Create and verify the required DNS records before debugging virtual hosts.
  • Put the canonical name in Apache ServerName or include it in the NGINX server_name list.
  • Put every alternate Apache name in ServerAlias, or list every exact NGINX name explicitly.
  • Use wildcard server names and wildcard certificates only when their one-level scope matches the design.
  • Create matching HTTP and HTTPS configurations, with certificate names covering every HTTPS hostname.
  • Validate syntax, inspect host-selection output, reload, and test each alias with its real hostname.
  • Choose either a permanent canonical redirect or deliberately support each hostname in application URLs, cookies, CORS and security-sensitive links.
  • Define what an unmatched hostname should receive instead of relying accidentally on configuration-file order.

Frequently Asked Questions

Can aliases use different DNS providers?

Yes. The records may be managed in different DNS zones or providers, but each hostname must ultimately resolve to an address where the intended web-server configuration is listening.

Do I need separate document roots for aliases?

No. Multiple names can share one Apache VirtualHost or NGINX server block and the same root. Use separate blocks only when a hostname needs different content, policies or application routing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does adding a DNS record not make the alias work immediately?

DNS resolvers cache answers for the record’s TTL, and the server still needs a matching host configuration and, for HTTPS, certificate coverage. Check each layer independently rather than treating DNS propagation as a web-server reload.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.