A record redirects to ip instead of domain

I have 2 web applications which are on different hosts. The main one ( is on another hosting with domain connected to it, the second one ( is a wordpress website on DigitalOcean. For this, in the dns manager I created an A record which is pointing to ip of the DigitalOcean Droplet. After that, I setted the wordpress application with the desired subdomain and added SSL certificate for the subdomain in droplet.

The connection is working fine, when I’m accessing, it is redirecting to the wordpress website, but if users for the first time type, they are being redirected to https://ip_adress and gets a “ERR_CERT_COMMON_NAME_INVALID”

I tried to add a redirect from ip to subdomain in apache config, but without any result…

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^18\.182\.216\.244$1
RewriteRule ^(.*)$$1 [L,R=301]

What can I do to solve this issue ?

Submit an answer
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
July 5, 2022

Hi there,

Once you’ve pointed your domain name to your server IP address, you would also need to define your new WordPress site and home URLs so that they match your new domain name. One way to do that would be to add the following to your wp-config.php file:

define( 'WP_HOME', '' );
define( 'WP_SITEURL', '' );

Make sure to also install an SSL certificate so that you could have HTTPS enabled: