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

怎么强制用户访问www域名?

  •  
  •   asing · 2012-12-17 17:54:56 +08:00 · 3356 次点击
    这是一个创建于 4149 天前的主题,其中的信息可能已经有所发展或是发生改变。
    apache开启了 www.example.com example.com
    域名也绑定了两个域名

    怎么强制用户使用www.example.com

    例如用户输入example.com 跳转到www.example.com

    谢谢:)
    5 条回复    1970-01-01 08:00:00 +08:00
    andyliu
        2
    andyliu  
       2012-12-17 18:20:56 +08:00
    301定向即可。
    asing
        3
    asing  
    OP
       2012-12-17 18:21:50 +08:00
    我错了!

    好了。
    mgplus
        4
    mgplus  
       2012-12-17 18:23:52 +08:00
    URL Rewrite:
    RewriteCond %{HTTP_HOST} ^www\.(.*)
    RewriteRule (.*) http://%1/$1 [R=301,L]
    sophy
        5
    sophy  
       2012-12-17 18:29:01 +08:00
    301
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5842 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 02:00 · PVG 10:00 · LAX 19:00 · JFK 22:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.