miao
V2EX  ›  Apache

.htaccess 如何强制所有首页的 URL 301 跳转到 https://www.example.com ???

  •  
  •   miao · Mar 10, 2016 · 2225 views
    This topic created in 3742 days ago, the information mentioned may be changed or developed.
    假设 域名是 example.com
    那么如何设置 .htaccess ???
    将如下三个首页 URL 跳转到 https://www.example.com
    http://example.com
    https://example.com
    http://www.example.com
    1 replies    2016-03-14 21:13:43 +08:00
    alect
        1
    alect  
       Mar 14, 2016   ❤️ 1
    #跳转所有非 https 请求到 https
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://www.example.com %{REQUEST_URI} [L,R=301,NC]
    #跳转裸域 ssl 到 www ssl
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule (.*) https://www.example.com .com%{REQUEST_URI} [L,R=301,NC]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5522 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 07:07 · PVG 15:07 · LAX 00:07 · JFK 03:07
    ♥ Do have faith in what you're doing.