【问题标题】:Apache 2.2, (MOD) SSL and Mod Rewrite via .htaccessApache 2.2,(.htaccess 中的 MOD_SSL 和 Mod_rewrite
【发布时间】:2009-12-16 20:07:34
【问题描述】:

我想做的是以下,

1) 防止正常的非安全页面显示为安全 2) 防止安全页面显示为正常的非安全页面 3) 按原样显示安全页面,由其链接指定

还请注意,即 ./contact/subscribe 是安全的,但不是 ./contact/welcome。我尝试了一些在网上找到的条件和规则,但我碰壁了——无休止的重定向等等。

感谢您对此的任何想法,因为我无处可去:(

【问题讨论】:

    标签: apache .htaccess ssl


    【解决方案1】:

    例如尝试其中一些

    <IfModule mod_rewrite.c>
      ## redirect anything that is not secure and is in folder secure-pages to the secure version
      RewriteCond %{HTTPS} !=on
      RewriteRule ^secure-pages/(.*)$ https://example.com/secure-pages/$1 [R=301,L]
    
      ## 301 redirect and force contact/subscribe to be secure
      RewriteCond %{HTTPS} !=on
      RewriteRule ^contact/subscribe$ https://example.com/contact/subscribe [R=301,L]
    
      ## 301 redirect and force contact/subscribe to be NOT secure
      RewriteCond %{HTTPS} =on
      RewriteRule ^contact/welcome$ http://example.com/contact/welcome [R=301,L]
    
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-19
      • 2011-03-14
      • 1970-01-01
      • 2010-09-20
      • 2011-01-26
      • 2011-03-01
      • 1970-01-01
      • 2010-09-20
      相关资源
      最近更新 更多