Redirect IP to domain name

I'm using Google cloud platform to create WordPress, and very VM has an IP to connect. When I configure my domain to the IP address that is fine, but the IP address still can connect and it doesn't change to my domain.

I don't know why is that. I'm using CloudFlare as my DNS and all setting is correct, I even used the plugin of "search & replace" to replace all IP address to my domain name, but it still shows IP in urls in menu when we access site through the IP and those urls are working

How can I do let IP Address auto redirect to domain address??

We tried htaccess redirect but it still does not work.