cosmopath
By:
cosmopath

Domain automatically redirecting to droplet IP - one-click Wordpress installation

March 31, 2017 131 views
WordPress Ubuntu 16.04

I'm using the one-click Wordpress installation which is run on Ubuntu 16.04. I had my domain set up prior to installing WP on my droplet, and when I try to access my domain it redirects to my droplet IP's address with the WP installation.

Tried changing the Site Address (URL) to the site - it did nothing. Then I also changed the Wordpress Address (URL) and I couldn't access Wordpress anymore. It kept redirecting to the domain and my browser said it couldn't find the DNS address so I was stuck on an error page. Tried rebuilding and I faced the same problem. (yes, I did try clearing my browser's cache too)

How can I fix this? I want my WP installation so that all pages are on my domain. I don't want it to redirect to the IP. I already changed nameservers and set up an A record at @.

Thanks!

1 Answer
jtittle March 31, 2017
Accepted Answer

@cosmopath

Did you set the domain configuration within ./wp-admin or inside of ./wp-config.php? When you're changing the URI, it's best to set this in ./wp-config.php using constants since the second you do it within the control panel, the settings take whether they're right or wrong.

The benefit here is that ./wp-config.php is loaded on each page load, since it'll load before the rest does, it ensures that the URI's are correct.

Open up ./wp-config.php and below the line define( 'WP_DEBUG', false );, add:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Change http://example.com to your domain, save ./wp-config.php, reload your page.

  • Thanks so much! I did set the configuration with /wp-admin. Just did this and it worked perfectly.

Have another answer? Share your knowledge.