We have requirement to convert all http requests to https requests and append .xyz.com to the server name. For that i have written the following rule which is working for http requests but does not work for https requests.
RewriteRule ^(.*)$ https://%{SERVER_NAME}\.xyz.com%{REQUEST_URI} [R]
If I type http:// lvldraspnetserv01, it redirects to https:// lvldraspnetserv01.xyz.com as required.
However, if I type https:// lvldraspnetserv01 it does not redirect to https:// lvldraspnetserv01.xyz.com, causing the certificate to fail.
Best Answer
Try it like this: