全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

哪位大侠帮我实现别的目录也能跳转

[复制链接]
跳转到指定楼层
1#
发表于 2013-4-19 22:50:46 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

location ~ /index.shtml{rewrite (.*) /index.html permanent;}
随手写的 只支持站点根目录跳转 别的目录也要跳转要小改一下
上面这是一位大侠写的。只能跳转到根目录,

我想要实现在当前目录跳转。 比如/111/222/index.shtml ,就能跳转成   /111/222/index.html

我实在不会,瞎弄弄成下面这样,根本实现不了。
location ~ /(.*)/index.shtml {rewrite (.*)$ $1/index.html permanent;}
13#
发表于 2013-4-19 23:20:12 | 只看该作者
NginX的规则还是挺好写的 熟悉一下正则就好 我比较讨厌Apache的XML式的规则 而且是十分的讨厌。。
12#
发表于 2013-4-19 23:14:18 | 只看该作者
云生 发表于 2013-4-19 23:12
rewrite  ^/(.*)\.shtml$ /$1.html permanent;
我用这个成功了,感谢!

我那个不行?

点评

刚试了一下,也可以的。  发表于 2013-4-19 23:17
11#
发表于 2013-4-19 23:13:35 | 只看该作者
云生 发表于 2013-4-19 23:12
rewrite  ^/(.*)\.shtml$ /$1.html permanent;
我用这个成功了,感谢!

哦也
10#
 楼主| 发表于 2013-4-19 23:12:09 | 只看该作者
aarwwefdds 发表于 2013-4-19 23:10
location ~ .*/index\.shtml{rewrite (.*)/index\.shtml $1/index.html permanent;}

刚才给你发了新的 其 ...

rewrite  ^/(.*)\.shtml$ /$1.html permanent;
我用这个成功了,感谢!
9#
发表于 2013-4-19 23:11:17 | 只看该作者
云生 发表于 2013-4-19 23:10
哈哈,成功了,感谢感谢
rewrite  ^/(.*)\.shtml$ /$1.html permanent;

流弊了
8#
 楼主| 发表于 2013-4-19 23:10:12 | 只看该作者
每次醒来 发表于 2013-4-19 23:03
哥也是菜鸟 用 (.*) 替换试试

哈哈,成功了,感谢感谢
rewrite  ^/(.*)\.shtml$ /$1.html permanent;
7#
发表于 2013-4-19 23:10:11 | 只看该作者
location ~ .*/index\.shtml{rewrite (.*)/index\.shtml $1/index.html permanent;}

刚才给你发了新的 其实貌似不用location也行
6#
发表于 2013-4-19 23:04:40 | 只看该作者

rewrite ^/(.*)/(.*)/(.*).html$ http://www.123.net/$1/$2/$3.html permanent;

菜鸟瞎蒙试试
5#
发表于 2013-4-19 23:03:23 | 只看该作者
哥也是菜鸟 用 (.*) 替换试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-14 01:45 , Processed in 0.070730 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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