Using Docker environment
1. Installing WordPress
Setup WordPress using docker. Here is the and Dockerfile
and docker-compose
file for the same. Please change the username, password, database names accordingly:
Build and start up the application using the command:
docker-compose up -d
2. Database changes
Backup the database from the old environment and restore it to the new environment inside docker. The links and certain URLs will still point to the old environment in certain tables in the database. Use the following queries to change the URLs:
3. Replace the wp-content folder
wp-content
is the directory where all the changes you made to the website goes. This includes imports, pages, PHP code, etc. Copy the folder from the old environment and paste it into the new environment after deleting the existing one.
4. Finalizing stuff
I was using Elementor page builder which provides the option to regenerate CSS, sync files and replace the URLs. If you are not using Elementor, you can skip this step or perform the equivalent step if you are using another page builder.
5. Fire Up!
Clear up the browser cache and fire up the website!
That’s all! These are some basic steps that allow you to easily migrate the wordpress website to a new domain.