Greetings everyone!
I have a weird issue with nginx. I want to redirect all traffic that comes from domain.com to www.domain.com. I also want to redirect the secure one: https:// domain.com to https:// www.domain.com.
My config is:
server {
listen 80;
listen 443 ssl;
server_name domain.com;
rewrite ^ $scheme://www.domain.com$request_uri? permanent;
}
and under here is a server section to handle the www.domain.com
The domain.com immediately gets redirected to www.domain.com.
The secure one (https:// domain.com) does not. I get a warning that the certificate is issued to www.domain.com etc.
Any suggestions are more than welcome!
Thanks!
FYI: I am new at this so I don't know how to accept answers and stuff so that people get points. Excuse the noobness :)