Question

I broke my wordpress setup for my droplet

I mistyped my domain name information. How can I fix this. I have dumped two urls restarting


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.

Bobby Iliev
Site Moderator
Site Moderator badge
October 14, 2024
Accepted Answer

Hey there!

As this is a fresh new Droplet, the quickest option would be to just delete the old one and create a new one.

Alternatively, you can fix the domain name issue in WordPress by updating the site URL and home URL. Here’s how you can do it:

1. Update via WP-CLI (if you have it installed):

Using the wp CLI you can easily update the URLs directly from your terminal. Run the following commands:

wp option update home 'http://your-correct-domain.com'
wp option update siteurl 'http://your-correct-domain.com'

Make sure to replace http://your-correct-domain.com with your actual domain.

2. Update via MySQL:

If you don’t have WP-CLI, you can update the URLs directly in the database. Follow these steps:

  • Log into your Droplet using SSH.
  • Access your MySQL database:
    mysql -u root -p
    
  • Once inside MySQL, switch to your WordPress database:
    USE your_database_name;
    
  • Now, run these SQL queries to update the URLs:
    UPDATE wp_options SET option_value = 'http://your-correct-domain.com' WHERE option_name = 'home';
    UPDATE wp_options SET option_value = 'http://your-correct-domain.com' WHERE option_name = 'siteurl';
    

Replace http://your-correct-domain.com with your actual domain name.

3. Update via wp-config.php (Temporary Fix):

If you’re locked out of the admin area, you can hard-code the URLs directly in your wp-config.php file as a temporary fix. Open the file and add these lines:

define('WP_HOME','http://your-correct-domain.com');
define('WP_SITEURL','http://your-correct-domain.com');

Once you’re able to access the admin dashboard, remember to remove these lines after fixing the URLs permanently.

This should get your WordPress setup back on track! Let me know if you need further help!

- Bobby

KFSys
Site Moderator
Site Moderator badge
October 14, 2024

Heya,

You have two options the way I see it. The first one is to find anywhere your domain has been hardcoded in terms of WordPress and change it or just create a new Droplet and add the proper domain.

I’ll go for the second choice in you don’t have anything else on that Droplet. I mean it’s not a problem to delete the current one and just create a new one.

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.