Migrating your WordPress site to a new domain or switching from HTTP to HTTPS can be daunting, especially when updating every instance of your old domain within your database. To simplify this process, we've created a powerful shell script that automates the entire procedure, ensuring a smooth and efficient transition.
What This Script Does:
- Backup Your Database: Before making any changes, the script creates a comprehensive backup of your MySQL database. This ensures that you have a fallback option in case anything goes wrong.
- Compress the Backup: The script then compresses the SQL dump file into a
.tar.gz Archive for easy storage and retrieval.
- Find and Replace Domain Instances: Utilizing the
sed Command: the script searches for all instances of your old domain and replaces them with the new domain across the entire SQL dump file.
- Re-import the Database: Finally, the script re-imports the modified SQL file into your MySQL database, seamlessly updating all domain references.