Report this

What is the reason for this report?

How to Change WordPress Site to Use a Totally New URL on the Same Droplet?

Posted on October 19, 2018

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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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:

  1. New droplet
  2. Link new url to the new droplet
  3. install wordress, ssl
  4. use a backup/restore plugin to move old wordpress site to new
  5. use WinSCP to find the old droplet’s domain.config file, copy that to the same location of the new droplet
  6. edit the domain config file with: server { server_name .mydomain.com; rewrite ^ http://www.adifferentdomain.com$request_uri? permanent; }

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

Hello there,

If you’ve already updated the Home and Site URLs from the WordPress admin panel then you can take the next step and update all the references for the IP address in your database as well.

**Note:**Please before you proceed take a snapshot of the droplet and also create a backup of the site (both files and database). This will ensure that if something goes wrong you can easily restore your site or droplet if needed

There are few ways to update the references in your database and it’s totally up to you which one you’ll choose. You can either change them manually if they’re not many or use an automation tool like a plugin or an external app.

One of the external apps that I’ve used and I know for sure that it’s working okay is: https://interconnectit.com/products/search-and-replace-for-wordpress-

You need to upload the script in your public_html folder and access in your browser, then you’ll need to fill in your database details and enter the old name (IP address) and the domain name you want to use. Then you can first use the dry-run option and if there are references that need to be updated you can then run the script and update them.

Also, an alternative way is to use a plugin called “Duplicator” it will update all of the paths and references from the dev domain to the main domain. This is why we usually recommend using a plugin called: Duplicator. The plugin will generate a backup for your website’s files and database. Then when you import the files to the new domain, all of the references for the old domain name will be updated properly with the correct ones.

Another option is to use the All-in-One WP Migration plugin. The plugin will do the replacement for you during import. You do not need to use any additional database search and replace

https://wordpress.org/plugins/all-in-one-wp-migration/

Once this is done you can check the site for any errors as there might be some hardcoded references for the IP address in the files like paths to directories, files and etc.

Hope this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.