V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
coolloves
V2EX  ›  问与答

请教一个 apache rewrite 规则.

  •  
  •   coolloves · 2016-06-23 17:12:15 +08:00 · 1478 次点击
    这是一个创建于 2856 天前的主题,其中的信息可能已经有所发展或是发生改变。

    只允许访问 www.a.comwww.a.com/a/index.html 其他的请求都转到 www.b.com 上 我写的规则是

     #RewriteCond %{REQUEST_URI} !(^/$|^/a/index.html$) [NC]
     
     #RewriteRule ^/(.*) http://www.b.com [L]
    

    但是我访问 www.a.comwww.a.com/a/index.html 还是被转到 www.b.com 上了

    请大家帮忙分析下,谢谢!

    2 条回复    2016-06-23 17:55:29 +08:00
    coolloves
        1
    coolloves  
    OP
       2016-06-23 17:54:53 +08:00
    请教下,^/$ 这个应该就是访问 www.a.com 这个根主页吧.
    我发现就是这个规则不生效
    请教下,如何设置当访问地址是 www.a.com/以外的都跳转走
    coolloves
        2
    coolloves  
    OP
       2016-06-23 17:55:29 +08:00
    一直用 nginx,有台老机器要跳转走,准备慢慢下了,发现真心不太会设置啊,请教请教,多谢大家
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   934 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:35 · PVG 05:35 · LAX 14:35 · JFK 17:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.