Hi,
I'm trying to combine these rules into one, but it's not working. Any idea in how to do that?
From:
##
# WWW to NON-WWW
##
server {
listen 80;
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}
##
# Force HTTPS
##
server {
listen 80;
server_name domain.com;
return 301 https://domain.com$request_uri;
}
To:
server {
listen 80;
server_name domain.com www.domain.com;
return 301 $scheme://domain.com$request_uri;
return 301 https://domain.com$request_uri;
}
I'm trying to combine these rules into one, but it's not working. Any idea in how to do that?
From:
##
# WWW to NON-WWW
##
server {
listen 80;
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}
##
# Force HTTPS
##
server {
listen 80;
server_name domain.com;
return 301 https://domain.com$request_uri;
}
To:
server {
listen 80;
server_name domain.com www.domain.com;
return 301 $scheme://domain.com$request_uri;
return 301 https://domain.com$request_uri;
}