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.
- 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
mytestsite and the
production are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.
--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 @mytestsite.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-three) to those of the destination environment (
vip @mytestsite.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-replacecommands 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
- It may be necessary to run additional
search-replaceoperations using WP-CLI commands after the import is complete. To accurately run a
search-replaceoperation, the command structure will depend on whether the
search-replaceis 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
In this example, the domain value
example.com is replaced with
example.go-vip.net in the local file
vip search-replace /Users/example-user/file.sql --search-replace="example.com,example.go-vip.net" --in-place
Last updated: August 31, 2023