Welcome! Log In Create A New Profile

Advanced

Is it possible to combine rules?

Posted by phuchan 
Is it possible to combine rules?
August 18, 2014 11:49PM
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;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 214
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready