How to Change WordPress Site URL to a Subdomain: Step-by-Step Guide
As a WordPress user, you may need to change your site's URL from the root domain (e.g. example.com) to a subdomain (e.g. subdomain.example.com) for a variety of reasons. Perhaps you're migrating to a new domain, or you want to create a dedicated subdomain for a specific section of your website.
Changing your WordPress site URL involves two settings – one in your WordPress dashboard, and one on your web server. If you only update the WordPress setting without also updating the web server, you'll likely run into issues with broken links, images, and other functionality.
In this step-by-step guide, we'll cover how to properly change your WordPress site URL to a subdomain, ensuring a smooth transition without any disruptions to your website.
Step 1: Update the WordPress Site URL
The first step is to update the WordPress site URL setting. Here's how to do it:
- Log in to your WordPress dashboard.
- Navigate to Settings > General.
- In the "WordPress Address (URL)" field, enter the new subdomain URL (e.g. https://subdomain.example.com).
- In the "Site Address (URL)" field, also enter the new subdomain URL.
- Click "Save Changes" at the bottom of the page.
It's important to note that changing the WordPress site URL will not automatically update all the links and content on your website. You may need to manually update any hardcoded URLs in your content, plugins, or custom code.
Step 2: Update the Web Server Configuration
The second step is to update the web server configuration to point the subdomain to your WordPress installation. The exact steps will vary depending on your web server setup, but here's a general overview:
For Apache (cPanel):
- Log in to your cPanel dashboard.
- Locate the "Domains" section and click on "Subdomains."
- Click "Create a New Subdomain."
- Enter the subdomain name (e.g. "subdomain") and select the root domain (e.g. "example.com").
- Select the appropriate document root (usually the path to your WordPress installation, such as "/public_html").
- Click "Create Subdomain" to save the changes.
For Nginx (non-cPanel):
- Access your web server's configuration file (usually located in the "/etc/nginx/sites-available/" directory).
- Locate the server block for your main domain and create a new server block for the subdomain.
- In the new server block, update the "server_name" directive to the subdomain URL (e.g. "subdomain.example.com").
- Update the "root" directive to point to the path of your WordPress installation.
- Save the configuration file and restart the Nginx service.
For Other Web Servers:
If you're using a different web server, such as Microsoft IIS, the steps may vary. Consult your web server's documentation or reach out to your hosting provider for guidance on how to configure a subdomain.
Step 3: Update DNS Records (Optional)
Depending on your domain hosting provider, you may also need to update the DNS records to point the subdomain to your web server. This is usually done through your domain registrar's website or control panel.
- Log in to your domain registrar's website or control panel.
- Locate the DNS management section.
- Add a new DNS record for the subdomain, typically an "A" record pointing to your web server's IP address.
- Save the changes and wait for the DNS updates to propagate (this can take up to 24-48 hours).
Troubleshooting Common Issues
After updating the WordPress site URL and web server configuration, you may encounter some common issues. Here are a few troubleshooting tips:
-
Broken Links and Images: If you see broken links or missing images, it's likely because the content is still referencing the old domain or URL. You can use a plugin like "Velvet Blues Update URLs" to update all internal links and content.
-
Redirects: If you want to redirect visitors from the old domain to the new subdomain, you can set up a 301 redirect in your web server configuration. This will ensure that search engines and users are directed to the correct URL.
-
Cache and Browser Issues: Clear your browser cache and the cache of any caching plugins or services you're using (e.g., Cloudflare, W3 Total Cache) to ensure that the new subdomain is properly loaded.
-
Database Issues: In rare cases, you may need to update the site URL directly in your WordPress database. Use caution when making database changes, and consider creating a backup first.
By following these steps, you should be able to successfully change your WordPress site URL to a subdomain without any major issues. Remember, the key is to update both the WordPress settings and the web server configuration to ensure a seamless transition.
If you're still experiencing problems, don't hesitate to reach out to your hosting provider or a WordPress expert for further assistance.
Flowpoint.ai can help you identify any technical errors that may be impacting your website's conversion rates and provide AI-generated recommendations to fix them, even after you've changed your site's URL to a subdomain.
Get a Free AI Website Audit
Automatically identify UX and content issues affecting your conversion rates with Flowpoint's comprehensive AI-driven website audit.