My app is served on https://beta.myapp.com
(I'm forcing https everywhere) and I now want to change to https://www.myapp.com
.
I'm wondering how to properly redirect every beta.
request to www.
.
At the moment www
is pointing to the same app and the app is then redirecting to beta
(you get a SSL error if you try to access https://www
though).
What I think is doable:
- Using the
www
certificate on the main app and creating another app (with thebeta
certificate) charged of redirecting every request to the other app. (e.g.https://beta.myapp.com/about
tohttps://www.myapp.com/about
). But my app is hosted on Heroku and I have to pay $20/mo/certificate so one more app means more expenses. - Get a wildcard/multidomain certificate covering both
www
andbeta
. But I already have 2 certificates so I don't really want to buy another one.
Is there any other/better way to di it?