Apache Redirect IP to Domain

To forward all web requests going to your apache webhosts’ IP to a domain, add the following to redirect to both files in between the VirtualHost tags:
/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-available/default-ssl.conf

Redirect permanent / https://www.yourdomain.com