Nginx set 301 redirect method

  
                  Seeing that someone is asking the setting method of nginx301 redirect, there are definitely a lot of people using LNMP of the military brother, now share the method of nginx setting 301 redirect! Add the following red code part to the XXX.conf corresponding to the host. www.45it.com is the only URL you are sure to use server{listen 80; server_name www.45it.com.cn 45it.com.cn www.45it.net 45it.net www.45it.com 45it.com;if ($host != 'www.45it.com' ) {rewrite ^/(.*)$ http://www.45it.com/$1 permanent;}index index.htm index.php default.html default.htm default.php;root /home/wwwroot/xxx; Red code explains if the host header is not www.45it.com then the unified jump to www.45it. Com
Copyright © Windows knowledge All Rights Reserved