Most probably the Values in the Wordpress database for ‘home url’ and 'site url’ are wrong. As such you have 2 options, either start from the beginning, if you haven’t added anything to the Wordpress installation or change the values.
The first option, is pretty much clear, delete everything and start from the beginning, let’s check the second option and how can we change the necessary fields.
Change your home and siteurl manually
So, first you’ll need to SSH to your droplet.
The WordPress droplet, creates the DocumenrRoot in var/www/html. Go that folder and check the prefix of your database like so
grep 'DB' wp-config.php
The database should be named 'wordpress’ but let’s do it to be certain.
As soon as have the Database name, enter your mysql using the following command
Now that you have entered, you’ll need to start using your database so
As soon as you do, you’ll now be able to executing queries. Now if you run
select * from wp_options where option_name='home';
You’ll most probably see that the optionvalue is not your domain but ’C’ or something similar, we’ll need to change this. To do so, please execute the following querries
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
Please note you’ll need to change the 'oldurl.com’ with what it says in the option_value from the last query you ran. In order words the old domain name.
Additionally, you’ll need to put in the newurl.com as well. It can be http://example.com or http://domain.com, it depends on you but please make sure to add http or https depending on the protocol you wish to use.