When you first install a WordPress Multisite set up on Reclaim Cloud, your application will be installed on an automatically generated Reclaim Cloud domain (for example, env-01234567.us.reclaim.cloud). However, you may want to change the domain of your WordPress Multisite to an apex or subdomain that you own.
Install Wordpress Multisite
To change your WordPress Multisite domain, you'll first login to https://app.my.reclaim.cloud/ and install Wordpress if you haven't already. We have instructions on how to install WordPress on Reclaim Cloud, but you'll want to make sure that the box next to "Install WordPress Multisite Network" is checked when installing the application.
Point your domain and configure SSL cert
After your WordPress Multisite is installed, you'll want to point your domain over to the Public IPv4 attached to the application. We have instructions on how to point external domains to Reclaim here: Adding a Custom Domain to a Reclaim Cloud Environment.
You'll then want to ensure your domain is covered by an SSL cert. We have instructions on how to configure Let's Encrypt SSL certs here: Installing SSL Certificates on Reclaim Cloud using the Let's Encrypt Add-on.
Adjust your wp-config.php file
After your domain is pointed to the correct IP, you'll then want to change the domain inside of your wp-config.php file. To open and locate your wp-config.php file, you can hover over the AppServer and select the wrench icon to view the Config panel of your application.
Your wp-config.php file is most likely located at the following path: /var/www/webroot/ROOT/wp-config.php, which you can quickly locate by clicking the favorited webroot folder in the Config sidebar, opening the ROOT folder and then selecting the wp-config.php file.
Once the wp-config.php file is open, you can then locate where DOMAIN_CURRENT_SITE is defined in your file. For most setups, this can be located on line 104, but you can easily do a Ctrl+F command to locate that variable.
Once you've located where your DOMAIN_CURRENT_SITE is defined, you can update your domain from your automatically generated env domain to your new apex domain by replacing what is inside the single quotation marks. Once that domain is updated, click save to ensure that the changes take effect.
Here is an example if I was adjusting my domain from env-3227323.us.reclaim.cloud to example.com:
define( 'DOMAIN_CURRENT_SITE', 'example.com');
Complete a database search and replace
After your wp-config.php file is updated, you'll also need to complete a database search and replace in the terminal. To open your terminal, you can once again hover over the AppServer and click the terminal icon to open the WebSSH window.
Once the terminal is open, you can run the following commands:
-
Back up your database just in case:
wp --path=/var/www/webroot/ROOT db export -
Run a dry-run of your search and replace before actually completing the real seach and replace. The resulting output displays the details, including tables and how many replacements are being made:
wp --path=/var/www/webroot/ROOT --dry-run search-replace $old-domain $new-domain --all-tables -
Once you have verified the replacements are correct, you can proceed to run the following command to have the database updated accordingly:
wp --path=/var/www/webroot/ROOT search-replace $old-domain $new-domain --all-tables -
Flush your cache:
wp --path=/var/www/webroot/ROOT cache flush
For our example of changing my domain from env-3227323.us.reclaim.cloud to example.com, our commands would be the following:
# Backup the database
wp --path=/var/www/webroot/ROOT db export
# Do a dry run of your search and replace
wp --path=/var/www/webroot/ROOT --dry-run search-replace wp search-replace env-3227323.us.reclaim.cloud example.com --all-tables
# Complete the actual search and replace
wp --path=/var/www/webroot/ROOT search-replace wp search-replace env-3227323.us.reclaim.cloud example.com --all-tables
# Flush the cache
wp --path=/var/www/webroot/ROOT cache flush