SolidZORO
V2EX  ›  问与答

網站局部 URL 使用 httpd (SSL) 在 Apache 上如何實現?

  •  
  •   SolidZORO · Jun 3, 2015 · 2437 views
    This topic created in 4185 days ago, the information mentioned may be changed or developed.

    我的要求很簡單,只是想login用一下https,別的都走http。

    當然,這個需求我是實現了。

    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(login|regist)(?:\.html)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
    

    可是,login進入https後,點任何連結都是https,跳不回http了。

    求解答,不一定要給代碼,說說思路也可以。

    11 replies  •  2015-06-04 11:06:01 +08:00
    czheo
    czheo
    Jun 3, 2015
    1
    加一条规则,如果是其他页面是https再跳转回http
    messagebus
    messagebus
    Jun 3, 2015
    2
    我感觉可能与 HSTS 有关
    smileawei
    smileawei
    Jun 3, 2015 via iPhone
    3
    使用两个子域呢,比如https://login.xx.com
    wy315700
    wy315700
    Jun 3, 2015
    4
    login以后做一个302跳转到http页面,而不是直接显示页面
    SolidZORO
    SolidZORO
    OP
    Jun 4, 2015
    5
    @wy315700 嗯,謝謝。這個方法我之前也有看到,但不算測底,登錄之後肯定還要進個人頁和訂單頁,一樣是跳不出的,如果實在不行,算備選方案吧。
    SolidZORO
    SolidZORO
    OP
    Jun 4, 2015
    6
    @czheo 我也在試這個方案。不過apache的語句有點看不懂。


    ```
    !(login||regist) ? http : https;
    ```

    能這樣寫多好。
    wy315700
    wy315700
    Jun 4, 2015
    7
    @SolidZORO 你是用了相对路径吧,,试试看绝对路径
    SolidZORO
    SolidZORO
    OP
    Jun 4, 2015
    8
    @wy315700 比如說,在登錄模塊用戶跳出了https回到http。然後用戶進入結帳模塊,這是https的,忽然用戶點了關於我們,這時還是https,這樣程序就無法做http跳出了。
    wy315700
    wy315700
    Jun 4, 2015
    9
    @SolidZORO 你指定连接到Http不行吗
    href那里使用http
    SolidZORO
    SolidZORO
    OP
    Jun 4, 2015
    10
    @wy315700 這樣感覺要動的地方還是多了點。算了,先全站https。什麼時候有解再調。
    wy315700
    wy315700
    Jun 4, 2015
    11
    @SolidZORO

    果然是用的相对路径,,
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4201 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 09:22 · PVG 17:22 · LAX 01:22 · JFK 04:22
    ♥ Do have faith in what you're doing.