Question

Change URL in Wordpress

Hello good day I need help with the following it turns out that I have already done everything explained in the videos to have PHP, MYSQL and Wordpress installed, in a single Droplet but now I need to make the following change and it is the following buy this domain: tgvshoes. com, I have the domain configured in cloudflare.com, I need to make the change on my website in Wordpress, so that instead of this address: http://198.211.109.61/, I am redirecting to this domain tgvshoes.com, I already made the change of the URLs in Wordpress but what is happening to me is that every time I make this change I lose access to the Wordpress wp-admin and the website is also damaged, many times connecting to the database error data. The error message is this: error establishing a database connection wordpress, please if anyone can help me with this since I have been trying to solve this error for several days and on the Internet the only documentation I have found is for Web Hosting servers such as Blue Host and Go Daddy example to give an example, but from Digital Ocean I have not found precise information about this specific error.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
April 3, 2020
Accepted Answer

Hello, @robertoagudeloc

If you’re 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 plugin or 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 it your browser, then you’ll need to fill 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!

Regards, Alex

Hi,

You need to make sure you have valid details of the database on wp-config.php to fix the database connection issue.

Also make sure proper siteul and home URL is set for wordpress

https://iserversupport.com/blog/how-to-change-wordpress-website-and-home-url-in-phpmyadmin-and-command-line/

You can follow the above documentation to set proper link via commandline and phpmyadmin.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

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.