Skip to content

Updating domain name values

If a database file for import contains domain name values that do not match the VIP Platform destination site’s domain name, a --search-replace operation must be done before or during import.

  • The domain name value for an unlaunched VIP Platform environment is typically a convenience domain (e.g. example.go-vip.net).
  • Search and replace values are separated by a comma only. There are no spaces between the values.

VIP-CLI command examples

For demonstration purposes, the <app-name> value example-app and the <env> value production are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.

Pass the  --search-replace option with the VIP-CLI command vip import sql.

In this command example, the domain http://localhost is replaced during the import process with the convenience domain https://example.go-vip.net of the unlaunched destination VIP environment:

vip @example-app.production import sql /Users/example-user/file.sql --search-replace="http://localhost,https://example.go-vip.net"

Updating multiple domain name values

When importing a database file to a WordPress multisite environment, a --search-replace operation should be included for each network site that is included in the SQL database file.

In this example command, a --search-replace operation is included to replace the domains of 3 network sites in the database file (local-site.com, site-two.local-site.com, local-site.com/site-three) to those of the destination environment (example.go-vip.net, example.go-vip.net/site-two, example.go-vip.net/site-three):

vip @example-app.production import sql /Users/example-user/file.sql --search-replace="local-site.com,example.go-vip.net" --search-replace="site-two.local-site.com,example.go-vip.net/site-two" --search-replace="local-site.com/site-three,example.go-vip.net/site-three"
  • The order in which the search-replace commands are run can make a difference in the outcome. If --search-replace="local-site.com,example-site.com" is run before --search-replace="site-two.local-site.com,site-two.com", the result will be a site with the domain example-site.com, a site with the domain site-two.example-site.com, and no site with the domain site-two.com.
  • It may be necessary to run additional search-replace operations using WP-CLI commands after the import is complete. To accurately run a search-replace operation, the command structure will depend on whether the search-replace is targeting an entire single site, multisite, or specific tables.

Updating domain name values prior to import

Domain name replacements can be made in the SQL database file prior to import. This can be useful to allow the results of the search and replace operation(s) to be verified prior to importing the file to a VIP Platform environment

To update domain name values in a file located on a local machine, pass the  --in-place option with the VIP-CLI command vip search-replace.

In this example, the domain value example.com is replaced with example.go-vip.net in the local file file.sql:

vip search-replace /Users/example-user/file.sql --search-replace="example.com,example.go-vip.net" --in-place

Last updated: December 22, 2023

Relevant to

  • WordPress