Hello, this subject keeps coming up. It is how do I work on sites without breaking the live thing. Then taking the changes and pushing them into production.
This is the method that I use. There are hundreds of ways to do this. This is just my preferred.
First step is to use this plugin by ServMask. It is rock solid. The free version supports sites up to 500MB in size. That might not sound like a lot but it is enough in most cases.
Install and activate from the wordpress plugin repository.
Once installed click "backup location" = "local". This will archive every single thing that is in the site. It will wrap it up into a nice file with a .wpress file extension
There is hope. You do not need the pro version. If you want to support the company and save some time then by all means show the dev's some love.
If you want to go another route that is more time consuming then use the native import/export function of WordPress.
This method is not preferred because if there is an issue then you have no tidy backup file to lean on.
However, I have done it multiple times with no problem
Go to Bitnami wordpress stack -> virtual machine. Download the virtual disk file
Download VirtualBox. It is available for Linux, mac, and windows
Import the virtual disk into a new VM
Make sure to change the networking to "bridged" also if needed change the disk space size.
If you used all-in-one then the plugin will be preinstalled on the new stack. All you need to do is select the backup and let it do its thing.
If you used the wordpress native import/export then follow the above steps.
After all is complete the sandbox might not load. That is where the next step comes in
The "hosts" file on your computer enables hard DNS overrides. You can tell your computer to, when resolving a domain, resolve here instead of live dns records.
We do this with the sandbox because it prevents having to change the sandbox wordpress install domain. Saving time and ensuring a smooth transition back to the live server.
You can find the sandbox IP by typing "ip a" in the console or looking at dhcp leases on your router.
Easy enough right? there are some corks. Mostly that if it is an Elementor site with pro Elementor the license will not be active. There is no way to activate it except changing the WordPress install domain to something.dev
That is very annoying. For most plugins they will behave normally. I have never found one as tight fisted as Elementor.
Otherwise. If you need to visit the live site just change back the hosts file to not manually resolve the domain
Now the scary part. Overriding a live site. This can be nerve racking but just remember that you have a copy of the original files on the server.
If you used all-in-one then the original .wpress file will still be on the server. If you used the alternative method then you have the files downloaded.
Well when you are ready, take a backup of the staging site and reupload it to the live site. If you used the native method then you will also need to upload images to the live server separately. There is no automatic method for the live site to grab images from the sandbox.
Everyone has an opinion on how to do this best. Some use all online sandbox sites. This way is free. Some hosts have sandbox services, some do not.
Whatever the case the above methods will work every time. Regardless of hosts.
Any questions leave them bellow.