I have a website say example.com and want to redirect everything from http to https. Also I have additional requirement of redirecting http://example.com (and https://example.com) to https://example.com/Portal/loginpage. In addition, I have many applications that need to be accessible at URLs like https://example.com/app1, /app2, /support etc that should not be redirected to https://example.com/Portal/loginpage.
OS is CentOS 7. Apache/2.4.6 . I put the following entries in apache virtualhost file (80 and 443 ports). Both virtual host configs are in separate files.
RewriteEngine On
RedirectMatch ^/$ https://example.com/Portal/loginPage
As per the above set rule, only / should get redirected, not /app1, /app2 or /support.
Now the main redirection http://example.com to https Portal/loginpage is working fine. Even /app1 , /app2 are accessible in respective URLs without redirecting to Portal loginpage. But somehow https://example.com/support is getting redirected to Portal/loginpage. Tried various methods of redirections after following some online tutorials. None of them resolved the issue, infact some solutions created redirect loop and broken the main website also. Please help.