I need to be able to redirect all urls (non www and www) to https://www in Yii2.
I want to try to do this without using .htaccess
It's not a problem to create the urls via the urlManager in Components:
urlManager => [
'baseUrl' => 'https://www.somesite.com'
]
However, I'm struggling to do the redirects. I did take a look at this article http://www.yiiframework.com/wiki/407/url-management-for-websites-with-secure-and-nonsecure-pages - does that help in the context of Yii2?
EDIT
I made reference in my comment below that when I added $_SERVER['HTTPS'] = 'on' in the backend folder index.php, I get SSL without having to do anything with the .htaccess file which is great. This is used in the function getIsSecureConnection() in \yii2\web\Request.php
This was referenced in this article https://github.com/yiisoft/yii2/issues/9116
However, if I do the same on the frontend index.php file, I do not get the same behaviour.
For example
http://www.client-site-1.co.uk/backend => https://www.client-site-1.co.uk/backend
(I don't have a SSL on this domain at the moment!)
versus
http://www.client-site-1.co.uk => http://www.client-site-1.co.uk
Any help much appreciated !!