I am new to AWS, but not new to wordpress. I have created a wordpress website in AWS Lightsail. I noticed my static IP is not redirecting to my domain name. My domain name is - cinemachaser.com and the static IP is - 3.109.134.63.
The question may seem silly to aws expert, but when I was typing the IP (3.109.134.63), I was hoping it would redirect to my domain name cinemachaser.com. But it was not. However the wordpress was accessible. Then I typed cinemachaser.com and again my site was accessible. Means my wordpress website was accesible with my Static IP as well as my domain name.
I logged into WP-admin of site (3.109.134.63/wp-admin) and found that in settings, default url was the ip itself 3.109.134.63.
I checked cinemachaser.com/wp-admin and in this the default url was my domain name, not the IP.
This should not happen, i guess. The static IP should redirect to domain name, I guess.
I then, found a solution and edited wp-config file and deleted the following code -
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
and replaced it with
define('WP_SITEURL', 'http://DOMAIN/');
define('WP_HOME', 'http://DOMAIN/');
Now, the default site url in the wp-admin is changed back to domain name.
But the concern is that, the frontend of the website is also accessible via static ip.
3.109.134.63 is still loading the website
However, 3.109.134.63/wp-admin is redirecting it to cinemachaser.com/wp-admin
Is it not possible such that when I type the static IP, it redirects completely to domain name?