Search and Replace Database URLs

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.

Search_and_Replace_1.png

From there, click the settings wrench on the right-hand side next to the installation needed.

Search_and_Replace_2.png

Lastly, go to the Advanced tab and scroll down to see where the application is located in the file directory.

Search_and_Replace_3.png

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 WHM.

Search_and_Replace_4.png

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.

Search_and_Replace_5.png

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 --allow-root search-replace 'old url' 'new url'

Replace ‘old url’ and ‘new url’ with the appropriate values needing to be changed.

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

Search_and_Replace_9.png

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! If you run into any trouble, please reach out to our support team and we would be happy to take a look.

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

Reclaim Hosting Support Hours
8:00 am - 5:00 pm ET, Monday through Friday
Submit a Ticket
Get a quick and helpful response from the pros.
Need Extra Support?
No problem, we're here to help! Talk to us about Professional Services.