October DealsAmazon USOctober deal check: compare before you payAmazon 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Point a WordPress Subdomain to Its Own Domain on Ubuntu

Move a WordPress site from a subdomain to its own domain on Ubuntu by updating DNS, the Apache or nginx virtual host, WordPress URLs, and HTTPS in the right order.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To move a WordPress site from a subdomain such as blog.example.net to its own domain such as example.com on Ubuntu, change three layers in order: DNS, the Ubuntu web-server virtual host, and WordPress’s canonical URLs. Then issue a certificate for the new hostname, test both addresses, and only afterward decide whether to retire the subdomain. Skipping a layer commonly produces the wrong site, redirect loops, missing assets, or an inaccessible administrator.

What changes when a subdomain gets its own domain?

A domain name is only a label until several systems agree about it. DNS tells browsers which Ubuntu server to contact. Apache or nginx chooses a site configuration by matching the requested hostname. WordPress then generates links, redirects, cookies, and asset URLs from its configured site address. HTTPS adds a certificate that must include the hostname visitors use.

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.

For a normal, single-site installation, the migration is usually:

  1. Point the new domain’s DNS records at the Ubuntu server.
  2. Declare the new hostname in Apache or nginx and map it to the existing WordPress files.
  3. Change WordPress Address (URL) and Site Address (URL) to the new domain.
  4. Obtain a TLS certificate for the new hostname and redirect HTTP to HTTPS.
  5. Test the new address, administrator, redirects, and page assets before removing the old address.

WordPress Multisite is different: a subsite has network-level domain mapping in addition to DNS, web-server, and certificate work.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Before you change anything

Confirm ownership and access

  • You must control the destination domain’s DNS zone.
  • You need shell access with sudo on the Ubuntu server.
  • Identify whether the server runs Apache or nginx, and where the current WordPress document root is located.
  • Record the existing domain, database, web-server configuration, and any reverse proxy or CDN in front of the server.
  • Make a tested backup of the WordPress files and database. Keep the old hostname available until the new one works.

Do not request a certificate first. Ubuntu’s TLS guidance requires a registered domain with DNS records pointing to the server; certificate validation cannot succeed while the public name resolves elsewhere.

Choose the final hostnames

Decide whether visitors will use the apex name (example.com), the www name, or both. Use one canonical address in WordPress and redirect the other to it. A certificate request must include every hostname that will be visited directly, for example both example.com and www.example.com.

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

Step 1: Point DNS at Ubuntu

Create the required records

At the destination domain’s DNS provider, create an A record for the IPv4 address of the Ubuntu server. If the server has IPv6 and is configured to serve the site on it, create an AAAA record as well. Use the host name your web-server configuration will match; an apex record and a www record are separate names.

Hostname Record Value Purpose
example.com A Ubuntu server IPv4 address Routes the apex domain to the server
example.com AAAA Ubuntu server IPv6 address, if used Routes IPv6 requests
www.example.com A or CNAME Your chosen IPv4 target or apex name Serves the alternate public hostname

DNS changes are cached according to each record’s TTL, so different networks may see the old answer for a while. Check the public result from more than one resolver before troubleshooting the web server.

Verify resolution before configuring TLS

From a workstation, query both the A and AAAA records with your preferred DNS utility. The returned address must be the Ubuntu server’s public address. Also verify that the server firewall and hosting provider allow inbound TCP ports 80 and 443. A local /etc/hosts entry can help you test a site before public DNS changes, but it affects only the machine where you add it and cannot satisfy public certificate validation.

Step 2A: Configure Apache

Create a dedicated virtual host

Apache selects a virtual host using the requested hostname. Create a new file such as /etc/apache2/sites-available/new-domain.conf. Replace the example names and document root with your values:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/wordpress

    <Directory /var/www/wordpress>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/new-domain-error.log
    CustomLog ${APACHE_LOG_DIR}/new-domain-access.log combined
</VirtualHost>

ServerName is the primary hostname. Add every alternate hostname that should reach the same files as a ServerAlias. The DocumentRoot must be the directory containing wp-admin, wp-content, and wp-includes.

Enable the site and rewrite support

  1. Enable the configuration: sudo a2ensite new-domain.conf.
  2. Enable WordPress’s rewrite module: sudo a2enmod rewrite.
  3. Check the configuration for syntax errors: sudo apache2ctl configtest. Continue only when it reports a valid configuration.
  4. Reload Apache without stopping active connections: sudo service apache2 reload.

If an unwanted default virtual host answers requests that do not match, disable that site with sudo a2dissite followed by its configuration name, then run another config test and reload. Keep a copy of the old configuration so you can restore it if the new host is not ready.

Apache-specific failure points

  • A missing or misspelled ServerName causes Apache to fall back to another virtual host.
  • Without AllowOverride All (or an equivalent rewrite configuration), WordPress permalinks may return 404 errors even though the home page works.
  • Putting the new file in sites-available is not enough; it must be enabled with a2ensite.
  • Reloading an invalid configuration fails. Always run apache2ctl configtest before the reload.

Step 2B: Configure nginx

Create a server block

For nginx, create /etc/nginx/sites-available/example.com and link it into sites-enabled. The exact PHP-FPM socket depends on the installed PHP version; use the socket already used by the working WordPress site.

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    root /var/www/wordpress;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }

    location ~* /.ht {
        deny all;
    }
}

Replace /run/php/php-fpm.sock with the PHP-FPM socket on your Ubuntu installation. Copy the known-good PHP handling from the existing WordPress server block rather than guessing a versioned path.

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

Enable and reload nginx

  1. Create the symlink: sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com.
  2. Check syntax: sudo nginx -t.
  3. Reload after a successful test: sudo systemctl reload nginx.

Each site needs a unique server_name. If the new name is absent or the symlink was not created, nginx may serve the default site instead. Ubuntu’s multi-site pattern commonly uses a separate HTTP block and a TLS block; you can create the HTTPS block yourself or let Certbot update the configuration after the certificate request.

Step 3: Change WordPress’s canonical URLs

Single-site WordPress

Sign in at the existing administrator address while it still works. Go to Settings → General and change both fields below to the final HTTPS address:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
  • WordPress Address (URL): where the WordPress core files are installed.
  • Site Address (URL): the public address visitors use.

For a conventional installation, both values are usually identical, such as https://example.com. Do not leave a trailing slash in either field. Save once, then open the new address in a separate browser window. WordPress may sign you out because login cookies are tied to the host.

If changing the fields makes the dashboard inaccessible, define the values temporarily in wp-config.php before WordPress loads:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');

Use this as a recovery measure, not as a second conflicting source of configuration. Remove or revise the constants after the migration is stable if you want the values managed in the dashboard.

Update stored links and caches

Changing the two URL fields does not rewrite every old subdomain stored in post content, widgets, theme options, serialized settings, or plugin data. Search the database and configuration for the old hostname with a serialization-aware method, replacing only the old subdomain and preserving serialized data. Then clear WordPress page caches, object caches, CDN caches, and any reverse-proxy cache. Inspect the browser’s developer tools for requests still going to the old host or using insecure HTTP.

Step 4: Map a Multisite subsite

Understand the extra layer

In WordPress 4.5 and later, domain mapping is a native Multisite feature. A subsite that previously used a host such as subsite1.networkdomain.com can be mapped to example.com without the older third-party mapping approach. DNS, the web-server host, and HTTPS are still required; native mapping does not create those server-side settings.

From the network administration area, open the site’s settings and change its domain to the destination hostname according to the network’s mapping setup. Keep the network’s primary domain and other subsites unchanged. A network-wide change can affect every site, so confirm that you are editing the intended subsite rather than the network address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Cookies and administrator access

After mapping, login cookies must be valid for the mapped host. If the dashboard repeatedly returns to the login screen, review the network’s documented COOKIE_DOMAIN and wp-config.php settings. Do not copy a cookie-domain value from an unrelated installation: an incorrect value can prevent authentication across the network. Test both the mapped subsite and the network administration URL separately.

Step 5: Issue HTTPS for the new domain

Request a certificate with Certbot

Wait until the destination hostname resolves publicly and the HTTP virtual host responds. Then use Certbot’s plugin for the web server:

sudo certbot --apache -d example.com -d www.example.com
sudo certbot --nginx -d example.com -d www.example.com

Run the command that matches the server in use, not both. Certbot can install the certificate and update the Apache or nginx configuration, including an HTTP-to-HTTPS redirect. Ubuntu documents automatic service reloads after successful renewal. Confirm that renewal is enabled on the server and that the certificate covers every public hostname users may enter.

Check proxy and HTTPS awareness

If a load balancer, CDN, or reverse proxy terminates TLS before traffic reaches Ubuntu, WordPress must be told that the original request was HTTPS. A mismatch in proxy HTTPS headers can make WordPress redirect an already secure request back to HTTPS indefinitely. Configure the proxy and application consistently, and avoid stacking multiple competing redirect rules in the proxy, web server, and WordPress.

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.

Step 6: Test before retiring the subdomain

Use this verification sequence

  1. Resolve the apex and www names and confirm they return the intended server addresses.
  2. Request the site over HTTP and HTTPS. Confirm HTTP redirects once to the chosen canonical HTTPS host.
  3. Verify that the expected Apache virtual host or nginx server block answers, rather than a default site.
  4. Open the home page, several internal permalinks, search, and a page with images or other uploads.
  5. Sign in at /wp-admin/, open the editor, and save a harmless test change if appropriate.
  6. Inspect page source and browser network requests for the old subdomain, insecure URLs, failed CSS, JavaScript, fonts, or images.
  7. For Multisite, test the mapped subsite, network dashboard, media uploads, and logout/login behavior.
  8. Check server logs for 404 errors, PHP errors, repeated redirects, and requests reaching the wrong document root.

Keep the old subdomain available during this validation period. If it must remain discoverable, configure a deliberate one-hop redirect from the old canonical address to the new one after the new site is confirmed, rather than deleting the old host and losing a recovery route.

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

Troubleshooting the common failures

The wrong site appears

  • Verify DNS first; a correct web-server file cannot help if the hostname resolves to another machine.
  • Check the exact Host value sent by the browser against Apache’s ServerName/ServerAlias or nginx’s server_name.
  • On Apache, confirm the file is enabled. On nginx, confirm the symlink in sites-enabled exists.
  • Look for a default virtual host that catches unmatched requests and inspect access logs to identify the answering site.

Certbot cannot validate the hostname

  • Wait for DNS caches to expire and confirm public resolvers return the Ubuntu server.
  • Ensure port 80 is reachable; HTTP validation commonly needs it even when the final site uses HTTPS.
  • Request every hostname users will visit, including the apex and www when both are configured.
  • Remove conflicting DNS records or proxy settings that send validation requests elsewhere.

The browser reports a redirect loop

  • Compare WordPress Address and Site Address with the actual canonical HTTPS URL.
  • Check for duplicate redirects in WordPress, Apache or nginx, and an upstream proxy.
  • Confirm that the proxy’s HTTPS header is passed and interpreted correctly.
  • Clear browser, page, and CDN caches after correcting the configuration.

Styles, scripts, or images are broken

Search the database, theme settings, plugin settings, and generated caches for the old subdomain. Replace stale absolute URLs with the new HTTPS host using a tool that understands serialized WordPress data. Clear all relevant caches and reload the page without the browser cache. Mixed-content warnings indicate that the page is secure while one or more resources still use HTTP.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Multisite users cannot log in

Check the mapped domain recorded for the subsite, network cookie settings, and the COOKIE_DOMAIN guidance in wp-config.php. Test in a private browser session to exclude cookies from the former host. Ensure the network dashboard remains on its intended domain and that the mapped subsite’s certificate is valid.

Apache and nginx: which workflow applies?

Task Apache nginx
Configuration location /etc/apache2/sites-available/ /etc/nginx/sites-available/
Hostname directive ServerName and optional ServerAlias server_name
Enable a site sudo a2ensite file.conf Symlink into sites-enabled
WordPress routing mod_rewrite plus directory override permissions try_files and PHP-FPM handling
Validate configuration sudo apache2ctl configtest sudo nginx -t
Reload sudo service apache2 reload sudo systemctl reload nginx
Certbot integration certbot --apache certbot --nginx

The choice does not change the order of the migration: DNS must resolve first, the correct hostname must be declared, WordPress URLs must match, and the certificate must cover the final host.

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

Safe rollback plan

If the new domain fails, restore the previous WordPress URL values or temporarily use the WP_HOME and WP_SITEURL constants with the old address. Re-enable the old Apache site or nginx server block, reload the service after a syntax test, and remove only the new redirect rules that caused the failure. Keep the database and file backups untouched until logins, media, permalinks, and HTTPS have all passed testing. Once the migration is stable, document the final DNS records, canonical URL, certificate names, and active virtual-host file so a future administrator can reproduce the setup.

Decision checklist

  • Destination A and, where applicable, AAAA records resolve to the Ubuntu server.
  • The new hostname is declared in the correct Apache or nginx configuration and that configuration is enabled.
  • Configuration syntax passes before every reload.
  • Both WordPress URL fields use the chosen canonical HTTPS address.
  • Stored content, theme settings, plugin data, and caches no longer generate the old host.
  • Certbot issued a certificate containing every public hostname.
  • HTTP redirects once to HTTPS, with no proxy-induced loop.
  • Administration, media, permalinks, styles, scripts, and Multisite cookies work before the old address is retired.

Frequently Asked Questions

Can I test the new domain before changing public DNS?

Yes. A temporary entry in the testing computer’s /etc/hosts file can map the domain to the Ubuntu server, but it affects only that computer and cannot be used for public certificate validation.

Do I need separate WordPress files for the new domain?

No. A single-site migration normally points a new Apache virtual host or nginx server block at the existing WordPress document root. Multisite adds domain mapping but does not require duplicating the subsite files.

Should I remove the old subdomain immediately?

No. Keep it available until DNS, HTTPS, administration, assets, redirects, and (for Multisite) cookies have been tested. You can then add a deliberate redirect or retire the old host.

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

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.