Temporarily Change Domain


#1

If I am setting up a site for example.com but I want to keep the existing site up while I develope the new site. I know I have to adjust the Nginx config and probably the settings in the WordPress database so I can access the site from a subdomain like dev.example.com while I work but I don’t know the best way to do that. Obviously, after development is done I intend on it replacing the current site/server example.com is pointing to but I need the best way to temporarily change the site to work on dev.example.com for dev time.


#2

If you can spin up a new server, just create the site there with the exact same domain, and use a wildcard SSL. Then on your computer, edit your hosts file to point the domain to the IP of server #2, your dev server. Clear your DNS and browser cache. You’re now accessing the dev site as if it is live site. Test it out and you’ll see that when you’re browsing to domain.com you’re accessing a fresh WordPress install, but if you browse to the same domain on a different device like a phone for example, you’ll be seeing the live site.

At this point you want to make a full backup of the live site. Use the free plugin UpdraftPlus. Change your hosts file again to head to server #2. Restore the backup there. Make all your changes you want, this will be your dev environment. When you’re happy with your changes you can then create a backup from here (again using Updraft); revert the changes in your hosts file so your browser visits the live website, and restore the backup you’ve just made.

This way you can have a dev server that you can use to have as many dev websites as you like, meanwhile you never need to change the A records for any of the domains and visitors will always see the live site and only see updates/changes when you make a backup and restore from the dev site/server.


#3

I have done that for a while but I would really like an alternative. I wan’t a fresh start, not a backup of the existing site. The content will be similar but much of the design will change. I would rather just be able to jump back and forth and grab what I need from the existing site. I remember in v3 you were able to adjust the nginx config so that nginx would be waiting for a request from a client to whatever domain I wanted and I could just change it back when I was done, is there no way to do that same thing with v4?