伪静态优先级的问题

问答中心分类: Nginx伪静态优先级的问题
wwf19990814 asked 7 年 ago
大哥,问一个问题,
我把我的网站www.yunbow.cn全部301到www.yunbowang.cn,
http://www.yunbow.cn/index.html  这个链接就会301到www.yunbowang.cn/index.html
但是下面的
http://www.yunbow.cn/detail/movie/29197.html就不会301到www.yunbowang.cn/detail/movie/29197.html  ps:这个是伪静态的,并非静态
得出的原因是只要是符合的网站自定义的伪静态(rewrite ^/detail/(.*)/(.*).html$ /index.php?m=vod-detail-id-$2.html break;)的链接都不会在301跳转,请问这个怎么解
 

5 Answers
wwf19990814 answered 7 年 ago
百度都不知道怎么搜索

oneinstack answered 7 年 ago
vhost.sh 伪静态设置301跳转

wwf19990814 answered 7 年 ago
http://www.yunbowang.cn.conf  里面有

  if ($host != www.yunbowang.cn) {
rewrite ^/(.*)$ $scheme://www.yunbowang.cn/$1 permanent;
}

wwf19990814 answered 7 年 ago
上面的应该就是301跳转的代码了吧,什么还不跳转呢这个链接

http://www.yunbow.cn/detail/movie/29197.html

wwf19990814 answered 7 年 ago
完整代码在这里

server {
listen 80;
server_name www.yunbowang.cn yunbowang.cn www.yunbow.cn yunbow.cn;
access_log /data/wwwlogs/www.yunbowang.cn_nginx.log combined;
index index.html index.htm index.php;
include /usr/local/nginx/conf/rewrite/tp.conf;
root /data/wwwroot/www.yunbowang.cn;
#error_page 404 = /404.html;
#error_page 502 = /502.html;

if ($host != www.yunbowang.cn) {
rewrite ^/(.*)$ $scheme://www.yunbowang.cn/$1 permanent;
}

location ~ [^/]\.php(/|$) {
#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|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
}