全球主机交流论坛

标题: 求一个NGINX下的跳转规则 [打印本页]

作者: junhan    时间: 2013-9-29 12:39
标题: 求一个NGINX下的跳转规则
本帖最后由 junhan 于 2013-9-29 14:54 编辑

1级目录/2级目录随机/3级目录随机/文件名随机.html
1级目录/2级目录随机/文件名随机.html
.......

统一把上面的连接301到

1级目录/文件名不变.html

谢谢!
作者: pathletboy    时间: 2013-9-29 12:39
rewrite ^/(.+)/.+/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent;
rewrite ^/(.+)/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent;
作者: junhan    时间: 2013-9-29 12:52

作者: 糊里糊涂    时间: 2013-9-29 14:22
提示: 作者被禁止或删除 内容自动屏蔽
作者: junhan    时间: 2013-9-29 14:35
糊里糊涂 发表于 2013-9-29 14:22
if ( !#$ != 1级目录/文件.html){
rewrite /(.*) 1级目录/文件.html permant;
}


作者: pathletboy    时间: 2013-9-29 14:50
rewrite ^/.+/.+/.+/file.html$ http://www.yourdomain.com permanent;
rewrite ^/.+/.+/file.html$ http://www.yourdomain.com permanent;
作者: junhan    时间: 2013-9-29 14:53
pathletboy 发表于 2013-9-29 14:50
rewrite ^/.+/.+/.+/file.html$ http://www.yourdomain.com permanent;
rewrite ^/.+/.+/file.html$ http:/ ...

文件名也是随机的,再改一下吧
作者: junhan    时间: 2013-9-29 15:17
pathletboy 发表于 2013-9-29 15:00
rewrite ^/(.+)/.+/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent;
rewrite ^/(.+)/.+/(.*\.h ...

谢谢,,经测试把/$2去掉才可以了




欢迎光临 全球主机交流论坛 (https://ddzzz.eu.org/) Powered by Discuz! X3.4