在尝试通过https访问页面时,我遇到了问题。使用Codeigniter和离子Auth的Iam
这是我的配置:
$config['base_url'] = "http".((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "")."://".$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);这是我的.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (auth|login|pages)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(css|images|js|style)
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule> 错误310 (net::ERR_TOO_MANY_REDIRECTS):重定向太多了。
https://subdomain.domain.tld/auth/login的网页导致了太多的重定向。
发布于 2012-11-27 17:35:15
如果用户通过https进行访问,则重定向到非SSL页面,而https重定向回https:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (auth|login|pages)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]这会将用户发送到https (这将触发下面的Cond)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(css|images|js|style)
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301]这会将用户重定向回http,而http将无限地将其重定向到这里。
为您的%{HTTPS} on条件尝试以下操作:
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(css|images|js|style)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301](注意RewriteRule中的https )
https://stackoverflow.com/questions/13589399
复制相似问题