This questions has been asked many times on StackOverflow but my question differs a bit :
I have multiple sub domain websites :
As you can see, only admin is served through https.
I successfully created all my virtual hosts in Nginx and this works well.
But now, I would like to redirect all the clients that tries to access to other sub websites via https to http :
- https://www.example.com => redirect to http://www.example.com
- https://my.example.com => redirect to http://my.example.com
- https://client.example.com => redirect to http://client.example.com
=> only admin does the opposite.
My first thought was to set each https domain with a redirect :
server {
listen 443;
server_name www.example.com;
rewrite ^(.*) http://www.example.com$1;
}
And did this for each subdomains (www, my and client).
But this don't work, I have an SSL error on my browser (SSL record too long).
How can I do that?
Thanks for your help!