2009-12-16 59 views
1

什麼,我想要做的就是以下,Apache 2.2的,通過的.htaccess(MOD)SSL和現代重寫

1)防止非正常的安全網頁被顯示爲安全 2)防止被顯示爲正常的安全頁面非安全頁面 3)按照鏈接指定的原樣顯示安全頁面

還要注意的是,即./contact/subscribe這是安全的,但不是./contact/welcome。我嘗試了好幾種條件和規則在網絡上找到,但我碰了壁 - 無盡的重定向等

欣賞任何思考這個請我越來越沒有地方:(

回答

0

嘗試下列的示例

<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>