Question
How to Change WordPress Site to Use a Totally New URL on the Same Droplet?
Hello, please bear with me.
I am rebranding a blog that I run. I’m looking to change my website URL only (from domain1.com to domain2.com), and for it to continue existing on the same droplet.
Right now, I have backed up my droplet as it currently sits. I’ve purchased a new domain (domain2.com) and linked it to the same droplet (there are two domains linked to one droplet now)
The new domain (domain2.com) does not have an SSL certificate, the old domain does (https://domain1.com). Even though it is linked to my droplet, typing it in the URL bar takes me to a generic “Welcome to nginx!” page.
Question 1: Given my current position. What are my options to begin using (domain2.com) as my main wordpress domain? I know that installing a SSL certificate needs to happen. At what point though? I also know that I need to change the URL in the wordpress general settings to (domain2.com), but when do I do that?
I’ve been reading through similar questions online, but am apprehensive in beginning this task without knowing exactly what I’m doing. (domain1.com) is about a year old, with 300 posts, multipleplugins, SSL installed. I hope everything to be switched over to (domain2.com).
Can someone please provide steps for me to follow?
Thank you for your help and time.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
I suggest that you first try and duplicate your droplet and after that play with the new droplet till you get it right. But if you decide to go with your plan on the original droplet then i would suggest also creating offsite backups besides whatever back'up options are offered to you by DO.
The simple way(one that does not require tech/troubleshooting skills) would be to set'up a new wordpress droplet, link the new domain to it, set'up ssl(the same way you did on the original droplet) and migrate the old wordpress via any of the various methods available(I’ve seen some plugins that can do a simple backup/restore). If successful you can destroy the old droplet.
Did you install ssl via certbot or another method? If certbot, then this tutorial might be able to help you achieve your goal tho i’d still recommend that you do everything on a new droplet and then migrate the website.
Droplets are hourly billed as long as they exist less than about 30 days after which they are billed for the full month so you can easily experiment on a new droplet without getting to worry about costs.
Thanks a lot for taking the time. Creating a new droplet, linking the second domain to it, setting up SSL, and moving the contents via plugin seems like the easiest way for me to approach this.
Do you have insight on 301 redirects? It would be nice to not begin at 0 from an SEO perspective. Both of my domains are registered on Namecheap, which seems to provide a 301 redirect service. Is it as easy as setting my old domain to redirect? Would all the post domains also redirect to the new site?
Again, much appreciated. These things are insanely nerve wracking for someone who is on shaky feet re. server maintenance.
https://stackoverflow.com/questions/6045020/how-to-redirect-to-a-different-domain-using-nginx
https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-nginx
The above happens in /etc/nginx/sites-available/olddomain.conf .
Copy the olddomain.conf from the old droplet to the new(same location as above) and edit it. You can also experiment with a subdomain(new subdomain config file) just to test if the redirected urls work correctly.
You will also need ssl enabled on the old domain when you move it to the new droplet so a subdomain will be best for testing that as well before you move the old domain to the new droplet.
Let me know if the above is making any sense. :D
Also, here’s another tutorial worth reading and about nginx and multiple websites: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
Thanks again for your guidance. Just so I get this right, I’ll list the steps that I’ll be doing and hope you can confirm or correct me here:
New droplet
Question1: does the old domain need to be linked to the new droplet along with the new domain? (via DO domains workflow)
Question2: is setting up server blocks mandatory in my case? does the old website need to be active in any way for redirects to work?
Thank you for your time