Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Is it possible to combine rules?

$
0
0
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;
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>