I have external IP and hostname configured for my machine.
Inside the application, I am using only the domain names to access the APIs. So when i try to access my AP
This works for me. Add the configurations in httpd.conf of apache
CASE-1: when user hits http://XX.XX.XX.XX/main or http://ayz-abc.mysite.com/main it should be redirected to https://ayz-abc.mysite.com/main
Configuration:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
ServerName XX.XX.XX.XX
Redirect /main https://ayz-abc.mysite.com/main
CASE 2 : When user hits https://XX.XX.XX.XX/main it should be redirected to https://ayz-abc.mysite.com/main
Configuration:
NameVirtualHost *:443
DocumentRoot "/var/www/html"
#Server Name
ServerName XX.XX.XX.XX
SSLEngine on
SSLOptions +StrictRequire
# Redirect to the specified URL
Redirect /main https://ayz-abc.mysite.com/main
SSLRequireSSL
....
....