What we need:
- Access to the server with ssh
- Installed on the server WP-CLI
How to install WP-CLI on the server?
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- php wp-cli.phar --info (should output the WP-CLI version)
- chmod +x wp-cli.phar
- sudo mv wp-cli.phar /usr/local/bin/wp
Step-by-step instructions on how to quickly transfer a site. When you need to transfer to the dev version, all content and the database, or make a deployment
- Ssh connect to the server
- Go to the folder with the site cd /path/to/wp/folder
- We execute the command wp core download --allow-root
- Create DB in host panel
- We need to configure our wp-confing.php file for this we execute this command replacing the parameters with our data wp core config --dbname=YOUR_DATABASE_NAME --dbuser=YOUR_DATABASE_USER --dbpass=YOUR_DATABASE_PASSWORD --dbhost=if_differs_from_a_localhost --dbprefix=dbprefix
- We need to dump the database from the local machine and upload it to a folder on the server
- We import the database wp --quiet db import /path/to/file/exported-wp-sql.sql
- Now we need to change all URLs from local to main domain wp search-replace http://old-url.com https://new-url.com --all-tables
- We transfer all the files that are in the folder wp-content/ (if you have macOS \ Linux \ Unix you can execute the command in the terminal scp -r remoteuser@remoteserver:/remote/folder/ /path/to/wp/folder)
Now our site has been successfully transferred to the server
Share this