keepcalculator

06 Numbers and Powers

Run WordPress on a Subdomain Pointing to Another Server

Card No. 06·67932 · Updated · Standard formula, shown below

This guide explains how to host a WordPress blog on a subdomain (like blog.example.com) while the domain itself (like example.com) stays on a different server. This is useful when you want to keep your main site on one host (e.g., a company site or an e‑commerce platform) and run a separate WordPress blog on another server, often for performance or management reasons. You’ll need access to your domain’s DNS settings and the server where WordPress will be installed.

What You’ll Need

  • A domain name (e.g., example.com) with DNS management access (usually through your domain registrar or hosting provider).
  • A second server (or hosting account) where WordPress will be installed. This can be a VPS, a shared hosting plan, or a cloud server.
  • WordPress installed on that second server. If it’s not installed yet, you can use a one‑click installer from your host or install it manually.
  • The public IP address of the second server (e.g., 203.0.113.10).
  • An SSL certificate for the subdomain (optional but recommended). Many hosts provide free SSL via Let’s Encrypt.

Step-by-Step

  1. Set up WordPress on the second server. Install WordPress on the server that will host the blog. You can do this via your hosting control panel (like cPanel or Plesk) or manually by downloading WordPress and configuring a database. Make sure WordPress runs correctly when accessed via the server’s IP address or a temporary URL.
  2. Create a DNS record for the subdomain. Log in to your domain registrar’s DNS management panel (or the DNS management section of your hosting provider). Create a new A record with the host field set to blog (or whatever subdomain you want, e.g., news) and the value set to the public IP address of the second server. If you’re using a CDN or a reverse proxy, you might use a CNAME record instead, but an A record is the most straightforward.
  3. Wait for DNS propagation. DNS changes can take anywhere from a few minutes to 48 hours to propagate globally. You can check if the record has propagated using online tools like dnschecker.org or by running ping blog.example.com from your computer.
  4. Configure WordPress to use the subdomain. On the WordPress installation (the second server), go to Settings → General in the WordPress admin dashboard. Update both WordPress Address (URL) and Site Address (URL) to https://blog.example.com (replace example.com with your actual domain). Save the changes. If you can’t access the admin dashboard yet, you can edit the wp-config.php file and add these lines (replace with your domain):
    define('WP_HOME', 'https://blog.example.com');
    define('WP_SITEURL', 'https://blog.example.com');
  5. Set up an SSL certificate for the subdomain. If you want HTTPS (recommended), install an SSL certificate on the second server for the subdomain. If your host offers free SSL (like Let’s Encrypt via cPanel or Certbot), use that. After installing, make sure WordPress is configured to use HTTPS (the URLs should start with https://).
  6. Update any hard‑coded URLs. If you previously accessed the site via an IP or a temporary domain, there may be references to that old URL in the database. Use a plugin like Better Search Replace or run a SQL query to replace the old URL with https://blog.example.com.
  7. Test the subdomain. Open a browser and go to https://blog.example.com. You should see your WordPress blog. Click through a few pages and posts to ensure everything works.
  8. Set up redirects from the main domain (optional). If you want visitors who go to example.com/blog to be redirected to the subdomain, you can set up a redirect on the main server. This is done via .htaccess (Apache) or server configuration (Nginx). For example, in .htaccess on the main server you could add:
    Redirect 301 /blog https://blog.example.com/

Common Mistakes

  • Forgetting to update the Site URL in WordPress. If you only change the DNS but not the WordPress URLs, the site will still load but with broken links and assets.
  • Using an IP address instead of a domain in WordPress settings. This causes issues with cookies and redirects.
  • Not waiting for DNS propagation. You might test too early and think it’s broken when the DNS hasn’t updated yet.
  • Mixing up the A record host field. Some DNS panels require a trailing dot (e.g., blog.example.com.) while others don’t. Check your provider’s documentation.
  • Ignoring SSL. Without SSL, browsers may show security warnings, and some features (like geolocation) won’t work.

Tips

  • Use a subdomain that’s short and memorable, like blog or news.
  • If your main site is on a shared host, consider using a CDN for the blog to improve performance.
  • Keep the WordPress installation on the second server updated regularly (core, themes, plugins).
  • If you’re using a VPS, set up a firewall and secure SSH access to protect the server.
  • Consider using a staging copy of the blog before making changes to the production site.

Troubleshooting

  • The subdomain shows the main site’s content. This usually means the DNS record is pointing to the wrong IP. Double‑check the A record value.
  • The subdomain shows a “site can’t be reached” error. Check if the second server is running and that the firewall allows HTTP/HTTPS traffic (ports 80 and 443). Also verify that the server’s web server (Apache/Nginx) is configured to respond to requests for that subdomain (virtual host).
  • WordPress redirects to the old URL. This happens when the wp_options table still has old site URL values. Use phpMyAdmin to update the siteurl and home options, or use the WP-CLI command: wp option update home 'https://blog.example.com' and wp option update siteurl 'https://blog.example.com'.
  • Mixed content warnings (HTTP/HTTPS). If some resources load over HTTP, use a plugin like Really Simple SSL or manually update the URLs in the database.
  • Can’t access the WordPress admin after changing the URL. If you’re locked out, edit the wp-config.php file to add the WP_HOME and WP_SITEURL definitions, or use FTP to edit the file.

Frequently Asked Questions

Can I use a subdomain without pointing to another server?

Yes, you can host WordPress on the same server as your main site, but this guide focuses on the scenario where the blog is on a separate server.

Will this affect my main site’s SEO?

Subdomains are treated as separate sites by search engines. If you want to preserve SEO, consider using a subdirectory (e.g., example.com/blog) instead. However, subdomains can be fine if you don’t rely on the main site’s authority.

Can I use a CNAME record instead of an A record?

Yes, if your second server has a hostname (like server1.hosting.com), you can create a CNAME record pointing blog to that hostname. This is useful if the server’s IP changes.

What if my second server uses a different control panel (e.g., Plesk)?

The steps are similar. You’ll need to add a domain or subdomain in the control panel and ensure the document root points to the WordPress installation.

Do I need a separate SSL certificate for the subdomain?

Yes, because the subdomain is a different hostname. Many hosts provide free SSL certificates for subdomains via Let’s Encrypt. You can also use a wildcard certificate if you have one.

How long does DNS propagation take?

Typically from a few minutes to 48 hours. Most changes are visible within a few hours, but it can take longer depending on your ISP and the TTL of the DNS records.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →