I want to forward any requests for my server public IP address to the domain. I have the following code near the top of the httpd.conf file. The numbers in the second line are the actual IP address of the server.
However, when I visit the IP address in my browser, (1.2.3.4 in this example case) the website comes up with the IP and no https. Why does this code below not forward the request to the domain with https?
If the user visits http:// or https://1.2.3.4 I want them to be redirected to https://www.example.com.
# Rewrite engine to move the raw IP address to URL
RewriteEngine On
RewriteCond %{HTTP_HOST} ^1\.2\.3\.4$
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]