miao
V2EX  ›  Apache

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

  •  
  •   miao · Mar 10, 2016 · 2588 views
    This topic created in 3921 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
    alect
    Mar 14, 2016❤️1
    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   ·   Privacy   ·   Solana   ·   1429 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:59 · PVG 00:59 · LAX 08:59 · JFK 11:59
    ♥ Do have faith in what you're doing.