I tried to reproduce the same in my environment and got the results successfully like below:
Once you create Application gateway and point it’s IP address to your custom domain name such as to redirect https://domaionname.com
to https://www.domainname.com
you can add another listener with hostname “www.example.com
” and make sure that the previous listener with hostname “example.com
” redirects to the newly added listener.
Try to add another listener HTTPS like below:

So, 2 HTTPs listeners with hostnames - one without www and one with www. Add a rule to redirect without www HTTPS listener to with www HTTPS listener.
And another rule to make sure that with www HTTPS listener is bound to a backend pool to serve the traffic like below:
Application gateway rule to redirect the listener 1 to listener 2.


I created a new rule for listener 2 to use the HTTPS settings to send traffic to my backend pool.

Now Application gateway for domain name redirect to https://www.domainname.com
successfully like below:
