我怎么能configurationApache的httpd 2.x强制ssl的时候调用某个URL? 例如,让http://www.mycompany.com默认为纯文本,除非用户打开http://www.mycompany.com/secure (以下任何内容),否则将强制https ://www.mycompany .COM /安全。
谢谢
你可以使用mod_rewrite来做到这一点:
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/secure(.*) https://www.mycompany.com/secure$1 [R,L]
您应该启用mod_rewrite ,并将以下内容添加到您的Apacheconfiguration中:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} secure RewriteRule ^(.*)$ https://www.mycompany.com/secure/$1 [R,L]