How to set URL to appear as domain and not IP?

February 22, 2019 644 views
Apache Node.js DNS DigitalOcean Ubuntu 18.04

Having followed all the necessary steps to set up my domain in Digital Ocean, the domain name now points to the IP address as it should. However, my IP address is the one visible in the URL, not the domain. I understand this is a common issue with WordPress, but I am not using WordPress. I have uploaded all my files via FTP.

I have attempted changing configurations in sites-available, sites-enabled and other default configurations, still to no luck. I have been using port 443 for the website.

How could I solve this? Thanks in advance.

3 Answers

Hey friend,

Every time I’ve heard this story it has been about Wordpress, so forgive me if I make an incorrect assumption. However, if I assume correctly that it is, you would need to follow one of the methods here to make sure that Wordpress does not have your droplet IP listed as the site address in any of the places that it stores it:

https://codex.wordpress.org/Changing_The_Site_URL

Jarland

  • Hey, same here - apparently it always happens with WordPress. However, as I noted in this question, I’m (unfortunately) not using WordPress.

Let me try this again and see if I can do better :)

So here is what I gather to be the relevant variables:

  1. Not Wordpress (learn to read, Jarland)
  2. Virtual host is configured with ServerName to match the domain (implied at least)
  3. Calls to the domain redirect to the IP in the URL bar

So we know a redirect is happening. You did say it isn’t Wordpress but didn’t say that it is a static site, so I’m coming up with two possibilities:

  • Web server configured to redirect elsewhere. Check for any .htaccess, might as well do a full search for good measure: find / -name ".htaccess" If that is all clear, I’m going with:
  • It is another web application which is dynamic in nature, and may be hard coded to either use the IP as the URL or to pull it from the system. So you’d need to hunt for any code that could perform a redirect and then find out how it’s pulling the value that it redirects to. That’s pretty vague because it could literally be anything from my perspective at that point.

Jarland

Ok, so I still have not managed to figure this out and I have discovered another issue. The website seems to work fine for people in my Wi-Fi network, but does not work on any other networks. I have looked online and cannot figure out any reason why this might be the case. See for yourself: yakkomajuri.com or 188.166.144.57:443/.

It works for me on all devices and all other in the same network - but no one from outside it. To people outside the network it shows the plain index.html file, but does not use any other files.

  • I set up another server and decided to build a static website instead. So now, everything is configured correctly and the domain points to the right IP and shows up in the URL. However, specifically for all in my home network, the domain is still pointing to the wrong IP. Any guesses?

Have another answer? Share your knowledge.