nginx 301 은 ww 도 메 인 이름 을 가지 고 있 지 않 고 ww 도 메 인 이름 으로 재 설정 합 니 다.

989 단어 nginx
        ,      ,    ,     www   ,  :
	www.baidu.com      baidu.com     

  ,          。    ,  www    www,     2      ,     ,   ,      。

      ,    '  www' 301     ' www':
	
	apache:
		RewriteCond  %{HTTP_HOST}  example.org
		RewriteRule  (.*)          http://www.example.org$1

	nginx:

		//   1:
		// nginx     :This is a wrong, cumbersome, and ineffective way(      ,  ,     !)
		server {
		    listen       80;
		    server_name  www.example.org  example.org;
		    if ($http_host = example.org) {
		        rewrite  (.*)  http://www.example.org$1;
		    }
		    ...
		}

		//   2:
		// nginx     
		server {
		    listen       80;
		    server_name  example.org;
		    return       301 http://www.example.org$request_uri;
		}

		server {
		    listen       80;
		    server_name  www.example.org;
		    ...
		}


    :
	https://blog.csdn.net/qingjiaoforever/article/details/51393528
	http://nginx.org/en/docs/http/converting_rewrite_rules.html

좋은 웹페이지 즐겨찾기