Originally by Katie Hartraft.
You may need to search/find and replace all the URLs within one application’s database when you’re changing domain names. Or you may, instead, be changing all instances of http to https to fix unsecure content. Whatever the reason for replacing, here is how to make those changes.
To find the database an Installatron application is associated with, go to the user’s cPanel and select My Apps under Applications.
From there, click the settings wrench on the right-hand side next to the installation needed.
Lastly, go to the Advanced tab and scroll down to see where the application is located in the file directory.
Once we know where the application is, we need to SSH into the server where the site is hosted. You can do this through your local terminal or through Terminal in your cPanel under the Advanced section.
Once connected via SSH, navigate to the user’s directory which will be /home/cpanelusername. The user information can be obtained from cPanel on the right side when logged into the user’s account, or from their account listing in WHMCS or WHM.
Locate the directory where WordPress is installed and cd
to it. Then, run the following command to replace all instances of the old with the new domain URL:
wp search-replace 'old url' 'new url'
Replace ‘old url’ and ‘new url’ with the appropriate values needing to be changed.
You may need to log in as the user before running this command; to do this as root, you can run the following command, replacing $USER with the user's username.
su - $USER
Note: You will need to check the upload_path table within the wp-options. If you're working with a domain that specifically mentions the domain name in the upload path, the search and replace will change the reference to the domain name and cause conflicts. If you find the domain name has changed edit the table to use the old file path. This will allow WordPress to continue to post the images at the same location.
Lastly, if you changed the URLs, you may need to reimport the application instance in Installatron. Go back into the users cPanel and click on My Apps.
Locate the installation you need to reimport. This will show with a red error or you may not be able to access the wp-admin link.
Click the wrench view/edit details and then the Advanced tab. Scroll to the very bottom and put a check in Remove from Installatron? Click Save All
Once this completes the final step is to reimport the application. Go to All Applications, select the application to import, click the three-line icon next to + install this application, and then click import existing install.
Select the correct installation from the choices provided, including the correct directory and whether it is http or https, and proceed with the import.
And you should be good to go!
As always, if you have any trouble one of our support agents can lend a hand at support@reclaimhosting.com.