Question

Is there any way to access wordpress site by IP address and domain as well?

Posted November 17, 2021 101 views
WordPress

Hi,

I’m new with DigitalOcean and Wordpress, but I managed to build my wordpress based site guided with some tutorial on youtube and right now my site running smooth.

But I have a concern about accessing my site. Is there any way to access wordpress site not only by domain, but by ip address as well?

My wordpress is a marketplace wordpress, so I dont have any control panel to access it and no database as well.

Why I ask this, because I’m afraid I can’t access my website if my domain name expired due I will no longer have a plan to continue use it.

If we can’t do both, is there any way to access it by ip address?

I have read some articles said we can change the url of wordpress site to the ip address, but if that article was right, whic ip address I should use? IPv4 address of the droplet or floating IP?

With SSL installed on my site, I’m afraid if I change the url of wordpress to ip address, I can’t access my site. Am I wrong?

Any feedback is really appreciate and apologize if my English hard to understand.

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.

×
Submit an Answer
1 answer

Hi @nodamerah,

In your web service, you can set the website to be accessed by the droplet’s IP address as well your domain.

Since you are using the marketplace’s Wordpress, you should be using Apache as well.

Now, SSH to your Droplet and go to your /etc/apache2/sites-enabled folder. In there you’ll see two files 000-default.conf and 000-default-le-ssl.conf. In both files, you’ll need to add your Droplet’s IP address in the ServerAlias bit:

ServerName YourDomain.com
ServerAlias www.YourDomain.com XXX.XXX.XXX.XXX

Where YourDomain.com is the actual domain you want to use and XXX.XXX.XXX.XXX is your IP address.

You need to add your IPv4 IP address.

As for your other concerns, don’t worry, it’s not the end of the world if your domain expires, you can use hosts file on your computer to see your website and there are other possibilities. If it comes to that, you can always use the community for assistance, we’ll be happy to provide you with pointers!

  • Thank you very much for your guide @KFSys

    Please consider me as a man with zero knowledge about these technical things. I created my site with a guideline from a youtube video, so step that you give to me on part :
    Now, SSH to your Droplet and go to your /etc/apache2/sites-enabled folder. In there you’ll see two files 000-default.conf and 000-default-le-ssl.conf. In both files, you’ll need to add your Droplet’s IP address in the ServerAlias bit:” I have no idea how to change or edit those files.

    If you don’t mind, could you tell me how to do it or is there any tutorials out there to guide me?

    Another question is how about SSL? Using your method, can we access my site by IP address with SSL? because I installed SSL certificate (I forgot the name) when I installed wordpress.

    Right now my wordpress site using url http://mydomain.com and when I installed the SSL i remember I choose to prevent access to hmy website using https so everytime we access my domain, it always open https://mydomain.com. If i using your method, can we access it by https://myipaddress as well?

    Thank you for your assistance and i do apologize about my english.

  • Hi @KFSys
    I managed to follow your instruction, but my website on some browser keep redirected to the domain name.

    How about if I want to access my wordpress site only using the IP Address? Do I have to delete the domain in my droplet setting after I change my wordpress url in dashboard admin of my wordpress site?

    • Hi @nodamerah,

      So this might be due to the configuration of your WordPress as you suggest.

      You won’t need to delete your domain from your droplet’s configuration. This is not needed.