This guide will teach you how to reconfigure your website to use a subdomain (rather than a naked domain).
To complete this guide you will need your Serversaurus cPanel login details (these can be found within the Welcome to Serversaurus Business Hosting email which was emailed during your product order).
1. Login to cPanel and navigate to the Subdomain function, create your subdomain of choice, in this guide we will be using a subdomain labeled legacy.
2. This step varies depending on your setup, so please choose from 2a. or 2b. depending on which applied to your circumstance:
2a. You have web browser access to the production website
Using WP Migrate DB plugin, we're going to update the websites database to the new domain name and document root. So login to WordPress dashboard >> Plugins >> Add New >> Install WP Migrate DB >> Activate Plugin.
Then navigate to Tools >> Migrate DB >> Migrate >> Search & Replace >> Update the Replace fields with the subdomain and new directory path.
Once you've filled out the details, select Search & Replace at the bottom of the page to initiate the process, once processing is complete, the website will be dysfunctional. Do not worry, this is all part of the process, please proceed to step 3.
2b. You don't have web browser access to the production website
Open Terminal and SSH to your hosting server (update the following command with your server login details):
ssh username@servername.serversaurus.com.au
Edit the wp-config.php file:
vi public_html/wp-config.php
Above the WP_DEBUG entries enter the following:
Update the entry with your domain and save:
define( 'WP_HOME', 'https://www.legacy.yourdomain.com/’ );
define( 'WP_SITEURL', 'https://www.legacy.yourdomain.com/' );
Move the current production site to the subdomain document root:
mv public_html/* ~/legacy.yourdomain.com/
You will now be able to view the website. Our next step is using WP Migrate DB plugin, we're going to update the websites database to the new subdomain name and document root. So login to WordPress dashboard >> Plugins >> Add New >> Install WP Migrate DB >> Activate Plugin.
Then navigate to Tools >> Migrate DB >> Migrate >> Search & Replace >> Update the Replace fields with the production domain and new directory path.
Once you've filled out the details, select Search & Replace at the bottom of the page to initiate the process. Please skip step 3.
3. Move the current production site to the subdomain document root:
Update the following command with your subdomain details.
mv public_html/* ~/legacy.yourdomain.com/
The subdomain will now be live! Nice work
If you have any issues, remember to clear your website cache and also check there's no domain or path specific configurations within ~/legacy.yourdomain.com/. The following files commonly have domain or path specific configurations:
.user.ini
php.ini
.htaccess
wordfence-waf.php
wp-config.php
Comments
0 comments
Please sign in to leave a comment.