dance 发表于 2015-12-12 10:14:34

301目录跳转怎么做

找了下,貌似都是域名之间的跳转,http://www.xxx.com/gear-cutting
http://www.xxx.com/products

这种怎么做,找了好多试了下,貌似都不行!

licess 发表于 2015-12-12 14:15:51

rewrite ^/gear-cutting http://www.xxx.com/products last;

dance 发表于 2015-12-12 18:05:21

回复 2# 的帖子

location ~ .*.(php|php5)?$ {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    }
location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
    expires 30d;
    access_log off;
    }
location ~ .*.(js|css)?$ {
    expires 7d;
    access_log off;
    }
}
location /gear-cutting/ {
rewrite ^/gear-cutting http://www.gears-drives.com/products last;
}
server {
server_name gears-drives.com;
rewrite ^/gear-cutting http://www.gears-drives.com/products last;
}
是不是哪错了,为啥不生效呢

licess 发表于 2015-12-12 19:34:35

回复 3# 的帖子

给你发的rewrite是让你直接原虚拟主机server断里就行了,不用再加什么location

所有nginx修改配置文件都需要重启或reload才能生效且配置文件没错才行
页: [1]
查看完整版本: 301目录跳转怎么做