DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk12 min

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 web-server virtual host, WordPress URLs and TLS in the correct order.
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.oldsite.example to its own domain such as newsite.example on Ubuntu, you must change three layers in the right order: DNS, the Ubuntu web-server virtual host, and WordPress’s canonical URLs. Then issue a TLS certificate for the new hostname and test both addresses before retiring the old one. A normal single site needs a URL and virtual-host change; a WordPress Multisite subsite also needs domain mapping and cookie checks.

What “pointing a subdomain to its own domain” actually changes

A subdomain and a separate domain are different hostnames even when they use the same server and WordPress files. For example, blog.example.net might currently resolve to an Ubuntu server, while you want visitors to use example.org. The server can host both names, but each request still has to be routed and generated correctly.

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 tells browsers which server IP address answers for the new domain.
  • Apache or nginx selects a site configuration from the hostname supplied in the request.
  • WordPress generates links, login URLs, feeds, media URLs and redirects from its configured site address.
  • TLS needs a certificate whose names include the new hostname.

Changing only one layer produces familiar failures: the wrong site appears, WordPress redirects back to the old subdomain, CSS and images retain the old host, or HTTPS loops endlessly. Complete the layers in sequence and keep the old address available until the new one passes testing.

Decide whether this is a single site or a Multisite subsite

Normal single-site installation

A standard WordPress installation has one site URL. You normally point the new domain at the same document root, change WordPress Address (URL) and Site Address (URL), and update any hard-coded references to the old subdomain. The web server does not need a second copy of WordPress.

#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.

WordPress Multisite

In Multisite, the subdomain may be one site inside a network. WordPress documentation states that “In WordPress 4.5+, domain mapping is a native feature.” You map the subsite’s domain rather than changing the network’s primary address. Older Multisite releases required a domain-mapping plugin. DNS, the web-server host and a certificate are still required, and mapped-domain login cookies may need the COOKIE_DOMAIN and wp-config.php settings described in WordPress’s administration documentation.

Do not apply single-site URL replacement instructions to the whole network unless you intend to rename every site. Record the network’s current domain, the subsite’s ID and the destination domain before editing.

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.

Prepare a safe change

  • Confirm that you control the destination domain and can edit its DNS zone.
  • Identify the Ubuntu server’s public IPv4 address and, if used, its IPv6 address.
  • Record the WordPress document root, such as /var/www/wordpress, and whether Apache or nginx is serving it.
  • Back up the database and wp-config.php. Keep a copy of the current Apache or nginx site file.
  • Write down the existing subdomain and the exact new hostnames you will serve, including whether users should be allowed to visit the apex name, www, or both.
  • Check that you can obtain administrative access to Ubuntu and WordPress before changing DNS.

Plan the final URL form first—for example, HTTPS at the apex domain, with www redirected to it. Use that same form in WordPress, the certificate request and your tests. A certificate request for only one name does not automatically cover another name.

Point the new domain at the Ubuntu server with DNS

Create an A record for the destination domain pointing to the server’s IPv4 address. If the server has a publicly reachable IPv6 address, create an AAAA record as well. Add a separate record for www if that hostname will be served; it can point to the same address or be a DNS alias where your provider supports it.

Ubuntu’s TLS guidance requires a registered domain with DNS records pointing to the server before a certificate can be issued. DNS changes may be visible from some networks before others because recursive resolvers cache answers. Do not request the certificate until public DNS returns the intended address.

For an initial check, query both names from a machine outside the server’s local network:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
dig +short newsite.example A
dig +short newsite.example AAAA
dig +short www.newsite.example A

The returned address should be the Ubuntu host that contains the WordPress files. During a temporary migration, you can test a hostname on one client by adding it to that client’s /etc/hosts; Canonical’s Ubuntu WordPress tutorial describes this as an alternative way to map a hostname to the box. This local override does not replace public DNS and cannot be used for public TLS validation.

Configure Apache for the new hostname

Apache chooses a virtual host using the requested hostname. Create a dedicated file in /etc/apache2/sites-available/ rather than changing an unrelated site. The ServerName must be the new domain, and the DocumentRoot must be the directory containing this WordPress installation.

Create the site file

<VirtualHost *:80>
    ServerName newsite.example
    ServerAlias www.newsite.example
    DocumentRoot /var/www/wordpress

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

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

Save it as /etc/apache2/sites-available/newsite.example.conf. Replace the domain and document-root values with your own. AllowOverride All permits WordPress’s .htaccess rewrite rules; the directory permissions must also allow Apache to read the files.

Enable the host and rewrite support

  1. Enable the site: sudo a2ensite newsite.example.conf.
  2. Enable URL rewriting: sudo a2enmod rewrite.
  3. Check the configuration: sudo apache2ctl configtest. Continue only when it reports Syntax OK.
  4. Reload Apache without stopping active connections: sudo service apache2 reload.

Ubuntu’s Apache documentation describes ServerName as the hostname used by a virtual host and supports multiple sites on one server. If an enabled default host is catching requests for unknown names, disable that site only after confirming it is not needed: sudo a2dissite 000-default.conf, then run the configuration test and reload again. Leave the old WordPress host enabled while you migrate if it is still serving visitors.

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.

Check which Apache host answers

sudo apache2ctl -S

This lists parsed virtual hosts and their files. The new domain should appear under the intended configuration. If it does not, the file is not enabled, contains a syntax error, or Apache was not reloaded.

Configure nginx for the new hostname

With nginx, each site normally has a file in /etc/nginx/sites-available/ and a symbolic link in /etc/nginx/sites-enabled/. The new domain must appear in a unique server_name; otherwise nginx may use the first or default server block for the request.

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

Create an HTTP server block

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

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

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        # Set this socket to the PHP-FPM version installed on this Ubuntu host.
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~* .(css|js|jpg|jpeg|png|gif|svg|ico|webp)$ {
        try_files $uri =404;
    }
}

Save the block as /etc/nginx/sites-available/newsite.example, link it, test the syntax and reload:

sudo ln -s /etc/nginx/sites-available/newsite.example /etc/nginx/sites-enabled/newsite.example
sudo nginx -t
sudo systemctl reload nginx

The PHP-FPM socket shown is an example of the path format; use the socket belonging to the PHP-FPM package actually installed on your server. Ubuntu’s multi-site pattern uses a unique server_name for each site and a WordPress-compatible try_files fallback to index.php.

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

Add HTTPS handling

You can let Certbot add the TLS server block after the HTTP block is working, or create a separate TLS block yourself. A production site should redirect HTTP to HTTPS only after the certificate is valid and the HTTPS block serves the correct root. Avoid leaving two competing blocks with the same names and different roots.

Change WordPress’s canonical URLs

After DNS and the web-server host are ready, change the URLs WordPress uses to generate links. For a single site, sign in at the current address and open Settings → General. Set both WordPress Address (URL) and Site Address (URL) to the final destination, for example:

  • https://newsite.example for an HTTPS apex-domain setup; or
  • https://www.newsite.example if www is your canonical host.

Do not leave one field on the old subdomain. Save the settings once, then open a private browser window and visit the new address. WordPress may log you out because its authentication cookies are tied to the host.

When the dashboard becomes unreachable

If you saved an incorrect URL and cannot reach the dashboard, temporarily define the URLs in wp-config.php above the line that says WordPress editing should stop:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
define( 'WP_HOME', 'https://newsite.example' );
define( 'WP_SITEURL', 'https://newsite.example' );

Use the final scheme and hostname, then remove these temporary constants after correcting the values through the dashboard or database. Keeping them permanently can prevent later changes in the General Settings screen.

Update old-host references carefully

Changing the two URL fields does not rewrite every stored image, menu, widget or plugin setting. Search the database for the old subdomain and replace it with the new URL using a tool that understands serialized WordPress data. Take a fresh backup first. Also inspect theme files, environment variables, redirect rules and cache settings for the old hostname. Regenerate caches after the replacement so pages do not continue serving stale asset URLs.

Map a Multisite subsite to the new domain

For a Multisite network, first configure DNS and the web-server host exactly as above. Then use the network administration screens to assign the destination domain to the specific subsite. The network’s primary domain remains unchanged unless you are intentionally performing a network-wide migration.

  1. Back up the network database and wp-config.php.
  2. In Network Admin → Sites, open the target subsite’s edit screen.
  3. Set its domain to the new hostname and retain the correct path for the mapped site.
  4. Save, then test the mapped front end and /wp-admin/ in a private window.
  5. If authentication cookies fail, review the mapped-domain cookie guidance, including any COOKIE_DOMAIN definition, in WordPress’s Multisite documentation.

Do not use a network-wide search-and-replace merely to change one subsite’s domain. Multisite stores network and site-specific values separately, and a broad replacement can alter unrelated sites.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Issue a certificate for every hostname users will visit

Once public DNS resolves to the Ubuntu server and the intended HTTP virtual host answers, request a certificate with the Certbot plugin matching your web server. For Apache, Ubuntu documents:

sudo certbot --apache -d newsite.example -d www.newsite.example

For nginx, the equivalent documented command is:

sudo certbot --nginx -d newsite.example -d www.newsite.example

Include only names that resolve to this server and that you intend to serve. If you will not use www, omit it; if users will visit it, include it and configure a deliberate redirect or canonical host. Certbot can modify the matching Apache or nginx configuration and Ubuntu documents automatic service reload after successful renewal. Verify the renewal path with the dry-run option supported by your installed Certbot version, and monitor renewal failures rather than assuming the first certificate will remain valid forever.

Test the migration before removing the old address

Use a private browser window and test from a network that is not relying on a stale local DNS cache. Work through this sequence:

  1. DNS: confirm A and, where applicable, AAAA answers for the apex and www names.
  2. Virtual host: request the new hostname and confirm the expected site appears, not the default Ubuntu page or another customer’s site.
  3. HTTP: open http://newsite.example and verify the redirect target is the chosen HTTPS hostname.
  4. HTTPS: open the final URL and inspect the certificate name and browser security status.
  5. WordPress front end: test the home page, several posts, categories, search, feeds and pagination.
  6. Assets: inspect image, CSS and JavaScript requests in browser developer tools; each should use the new host and load over HTTPS.
  7. Administration: sign in at /wp-admin/, open the editor, upload a test image if appropriate, and verify media URLs.
  8. Redirect behavior: visit the old subdomain and decide whether it should permanently redirect to the new URL. Confirm there is no chain that bounces between hosts or HTTP and HTTPS.

WordPress warns that a reverse-proxy HTTPS mismatch can create an infinite redirect loop. If TLS terminates at a proxy or load balancer, ensure the proxy’s HTTPS header is passed and that WordPress is not being told simultaneously that the request is HTTP.

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

Troubleshoot the common failure modes

The wrong site or a default page appears

  • Run dig again and verify the destination resolves to the intended Ubuntu server.
  • Check the exact hostname in Apache’s ServerName/ServerAlias or nginx’s server_name.
  • For Apache, run sudo apache2ctl -S and confirm the new file is enabled.
  • For nginx, confirm the symbolic link in /etc/nginx/sites-enabled/ and run sudo nginx -t.
  • Look for a default virtual host that is catching unmatched requests, then reload after correcting the order or names.

Certificate issuance fails

Check that public DNS—not only /etc/hosts—returns the server address, that port 80 or the required validation path is reachable, and that every requested hostname points to this host. Wait for DNS caches to expire before retrying. Request the apex and www names together only when both are configured.

The site redirects forever

  • Compare WordPress Address and Site Address, including their http/https scheme and hostname.
  • Inspect Apache rewrite rules or nginx redirect blocks for a rule that sends HTTPS back to HTTP.
  • If a reverse proxy is involved, correct its forwarded HTTPS header and the corresponding WordPress setting.
  • Remove duplicate virtual hosts that redirect the same name in opposite directions.

Images, styles or scripts still use the old subdomain

Search the database, theme and plugin configuration for the old host, handling serialized values safely. Clear WordPress, page, object and CDN caches, then reload the page with developer tools open. Mixed-content warnings mean at least one resource is still requested over HTTP; locate that URL rather than masking the warning.

Multisite login fails after mapping

Confirm the subsite domain mapping, cookie-domain settings and any wp-config.php constants. Test in a private window to eliminate cookies issued for the old host. A network administrator may need to re-save the mapped site settings after the web-server and certificate changes.

Apache and nginx: which procedure applies?

Area Apache nginx
Site file /etc/apache2/sites-available/newsite.example.conf /etc/nginx/sites-available/newsite.example
Hostname directive ServerName and optional ServerAlias server_name
Enable site sudo a2ensite newsite.example.conf Symlink into /etc/nginx/sites-enabled/
WordPress routing AllowOverride All lets .htaccess provide rewrites try_files $uri $uri/ /index.php?$args; in the server block
Configuration check sudo apache2ctl configtest sudo nginx -t
Reload sudo service apache2 reload sudo systemctl reload nginx
Certificate integration sudo certbot --apache ... sudo certbot --nginx ...

The DNS and WordPress portions are the same for both servers. Only the virtual-host syntax, enablement layout, PHP handling and reload command differ.

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

When is it safe to retire the subdomain?

Keep the old host configured while search engines, bookmarks, feeds, integrations and cached clients transition. After the new domain passes front-end, administration, media, HTTPS and redirect tests, choose a single permanent redirect from the old host to the corresponding new URL. Preserve path and query strings where possible so old links remain useful. Do not delete the old virtual host or DNS record before confirming that the redirect itself is served by the intended site.

Once traffic and logs show that the old address is no longer needed, remove its configuration deliberately, renew the certificate covering the names you still serve, and update documentation, webhooks and third-party integrations that referenced the subdomain. Keep the migration backup until you have completed at least one successful restore check.

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 *

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver 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.