How to redirect droplet IP to Domain Name ?

My droplet can be visited from both IP & Domain

I am using Cloudflare with my Droplet. (

I want to redirect my ip to my domain

I am using Wordpress (Linux on Ubuntu 14.04) on Apache Server

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.

Sorry… couldn’t get my answer to format correctly and by the time I had messed around changing it, DO marked it as spam rolls eyes

Make sure your DNS records are set up correctly… A record lists your domain name pointing to your droplet IP address. CNAME record lists your www pointing to your naked domain name

In your server block, check that your domain name is listed as your server and you should be good to go. Not much point in me showing you my config for the server block as I’m using Nginx and its a little different to Apache. If you have done that, then I see no reason why if someone enters your IP address or your domain name, they wouldn’t resolve to the same location, because that is all I have done and it works for me.

Good luck.

Hi, First off, have you set up your DNS records correctly so that your domain name points to your IP address? e.g

Type                   Name                         Value                                                TTL
A           your droplet IP address       Automatic

CNAME        www                              Automatic

If that is done, then how is your server block defined? …Does it look like this?

server {
        listen 80;

        server_name YOURSITE.WHATEVER;

If you are set up like this, then I see no reason why you shouldn’t arrive at the same location regardless of what is entered into the address bar. Yours may look a little different as I am using Nginx, not Apache.

Not really sure exactly what you are asking… I am using the same set up as you I am using Wordpress (Linux on Ubuntu 14.04) with Cloudflare What exactly are you wanting to do? You have said that My droplet can be visited from both IP & Domain and that is correct no? but yet you added I want to redirect my ip to my domain I’m confused. You have been a little vague about your issue and somewhat confusing having stated that you can visit your domain from your IP address and Domain (assuming you’re referring to domain name)… that would be a correct set up, hence confusing?