How to move WordPress to new domain name


So with the move / switch to a new domain name, I encountered something that would seem simple enough to fix. My hosting company switched the site for me and the root domain name changed so everything was broken, i.e. the CSS and JavaScript were not loading and only unstyled text was showing. I thought (wasn’t sure at the time and was hoping for the best) that the problem was the root domain.

Now being a Drupal guy, I didn’t know much about WordPress, but I was hoping there was a root domain name setting in the admin dashboard. I called tech support for my hosting company and asked them what they could do to get my site back up and running properly. The tech support then said something that was to me alarming: they would have to restore the site and it would only be for the last backup they made–some time in April. All that blogging gone?! I was looking at the unstyled page and wondered if WordPress was actually working. It seemed like the homepage text was loading at least, so I hoped that the database was still good.

The big problem was that I couldn’t log in to the dashboard! I was using the normal login page, but when I put my email and password in and clicked “login”, I was sent to “Oops! That page can’t be found.” The reason for this was that the form on the site still had the old domain name in the action attribute. So I opened developer tools in Chrome, i.e. three-dot hamburger menu > More Tools > Developer Tools (Edge is the same menu and Firefox just calls it Web Developer Tools, but both through same hamburger menu)

Then I clicked the developer tools Element Selector button

And I then selected the form element, i.e. click on the user name or password field and the code for that form will appear in the developer tool pane. Then I double-clicked the action attribute URL and changed the URL in the field to include the new domain name as follows: “https://www.newdomainname.com/[input same blog name you had previously; mine was ‘mindtan’]/wp-login.php” Then without refreshing the page, enter your username and password then click “login.”

Unstyled admin dashboardYou should be led to the unstyled admin dashboard. Don’t be alarmed! Scroll down and click the link for General Settings.

Enter new domain name

On the next page scroll down to where it says “WordPress Address (URL)” and change the domain name portion of the URL, but again leaving the old name of the site/blog as above. In the next box, also enter the domain name, but without the site/blog name.

Site Loaded!

Scroll down and click “Save Changes.” Your site will load now.

Leave a Reply

Your email address will not be published. Required fields are marked *