nginx 301重定向的配置 100%无错,已测试
配置文件路径/usr/local/nginx/conf/vhost/zmanhua.com.confvi zmanhua.com.conf
代码如下:server
{
listen 80;
server_name www.zmanhua.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/zmanhua.com;
include zmanhua.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
server {
server_name zmanhua.com;
rewrite ^(.*) http://www.zmanhua.com$1 permanent;
}之后重启/root/lnmp restart 就好了~:victory: 注意一点:前面的server name只能包含带www的哦,不带www的写下面 我按照这个方法做的,百度还是收录的不一样,排名也不一样,快照也不一样
页:
[1]