全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 2319|回复: 7
打印 上一主题 下一主题

[Windows VPS] 求一个NGINX下的跳转规则

[复制链接]
跳转到指定楼层
1#
发表于 2013-9-29 12:39:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
50金钱
本帖最后由 junhan 于 2013-9-29 14:54 编辑

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

统一把上面的连接301到

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

谢谢!

最佳答案

查看完整内容

rewrite ^/(.+)/.+/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent; rewrite ^/(.+)/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent;
2#
发表于 2013-9-29 12:39:40 | 只看该作者
rewrite ^/(.+)/.+/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent;
rewrite ^/(.+)/.+/(.*\.html)$ http://www.yourdomain.com/$1/$2 permanent;
3#
 楼主| 发表于 2013-9-29 12:52:01 | 只看该作者
4#
发表于 2013-9-29 14:22:50 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
5#
 楼主| 发表于 2013-9-29 14:35:03 | 只看该作者
糊里糊涂 发表于 2013-9-29 14:22
if ( !#$ != 1级目录/文件.html){
rewrite /(.*) 1级目录/文件.html permant;
}

6#
发表于 2013-9-29 14:50:34 | 只看该作者
rewrite ^/.+/.+/.+/file.html$ http://www.yourdomain.com permanent;
rewrite ^/.+/.+/file.html$ http://www.yourdomain.com permanent;
7#
 楼主| 发表于 2013-9-29 14:53:29 | 只看该作者
pathletboy 发表于 2013-9-29 14:50
rewrite ^/.+/.+/.+/file.html$ http://www.yourdomain.com permanent;
rewrite ^/.+/.+/file.html$ http:/ ...

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

谢谢,,经测试把/$2去掉才可以了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-10-11 17:57 , Processed in 0.122564 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表