2016-05-03 17 views
1

我正在使用Amazon ELB和HTTPS(ELB将所有流量从443重定向到80)并且一切正常。Codeigniter - 重定向http至https,除了一页外(Amazon ELB)

现在我使用的下一个htaccess的代码从HTTP所有的请求重定向到https:

RewriteEngine On 
RewriteCond %{HTTP:X-Forwarded-Proto} !https 
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 
RewriteCond $1 !^(index\.php|assets) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 

及其工作的伟大,问题是,亚马逊ELB健康检查失败,因为HTTP到HTTPS重定向,有没有办法将所有流量重定向到https,只有一个url?

(这样我就可以使用URL有关HTTP健康检查和所有其余的HTTPS)

回答

1

试试这个:

RewriteEngine On 
RewriteCond %{HTTP:X-Forwarded-Proto} !https 
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 

RewriteCond %{HTTPS} on 
RewriteCond %{SCRIPT_FILENAME} /specific_controller/specific_method [NC] 
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] 

RewriteCond $1 !^(index\.php|assets) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
相关问题