Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
Because the LNMP system environment uses nginx instead of Apache, it is not simple to add code to the root directory when setting 301 redirects, because he needs to modify the configuration of the individual Web site conf file. Some friends want to say, why WordPress does not need to set, because of the particularity of the program, we create a blog when the choice is with the www or not with www, and then another will automatically internal redirection.
If you are another program you need to set it manually. The specific methods are as follows:
The first step, in our VPS under the/usr/local/nginx/conf/vhost/, we will see their own website name of the Conf file, and then the VI command to modify, you can also use FTP download to local changes and then passed up;
server_name www.laozuo.org laozuo.org;
if ($host!= ' www.laozuo.org ') {
Rewrite ^/(. *) $ http://www.laozuo.org/$1
permanent;
}
Index index.html index.htm index.php default.html default.htm default.php;
The above is modified, you compare, you lack, and then you can fill. Because I'm afraid everyone misplaced, so I copied the code before and after.
In the second step, we restart the LNMP using the following commands;
/ROOT/LNMP restart
In this way, you can enter the Web site without the WWW domain name, is not directly jump to the www. You do not trust, can also be detected through webmaster Tools is correct.
This article fixed link: http://www.laozuo.org/206.html | Old Left Blog