I have an Apache webserver running a bunch of web apps. I have successfully redirected incoming http traffic to https for every individual app, but I'm having trouble routing ALL traffic coming to the root path (which has nothing on it) to a specific app. I've got it working for http but not https.
So essentially right now the following URLS redirect correctly:
http://example.com/app1 -> https://example.com/app1 http://example.com/app2 -> https://example.com/app2 etc. http://example.com -> https://example.com/app1
but I can't figure out how to make this work:
https://example.com -> https://example.com/app1
My Apache config file contains the following:
<VirtualHost xxx.xxx.xxx.xx:80>
ServerName example.com
RedirectMatch 301 ^/$ /app1/
Redirect permanent / https://example.com/
</VirtualHost>
I have tried adding RewriteCond/RewriteRule pairs such as
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^/$ https://example.com/app1 [R=301,L]
as well as loads of other things that I thought ought to work and they either seem to do nothing or break other parts of my configuration.
In case it matters my SSL cert is multidomain as I also have other domains pointing to apps on this server. All of those work perfectly fine with just the following (they have no additional redirect requirements though):
<VirtualHost xxx.xxx.xxx.xx:80>
ServerName example2.com
Redirect permanent / https://example2.com/
</VirtualHost>
So how can I make https redirect from root to a suburi without breaking anything else?