SolidZORO
V2EX  ›  问与答

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

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


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

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

    果然是用的相对路径,,
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2633 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 68ms · UTC 15:18 · PVG 23:18 · LAX 08:18 · JFK 11:18
    ♥ Do have faith in what you're doing.