Apache httpd.conf for redirecting ip to hostname
Ok. You are missing a rewrite condition
<VirtualHost XX.XX.XX.XX>
DocumentRoot "/var/www/html"
#ServerName ayz-abc.mysite.com/
# Other directives here
RewriteEngine On
RewriteCond %{HTTP_HOST} !^ayz-abc.mysite.com$
RewriteRule /.* https://ayz-abc.mysite.com/ [R]
</VirtualHost>
If you don't include this condition it will redirect even with the hostname