Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 有根系统时HTTP到HTTPS_.htaccess_Ssl_Https - Fatal编程技术网

.htaccess 有根系统时HTTP到HTTPS

.htaccess 有根系统时HTTP到HTTPS,.htaccess,ssl,https,.htaccess,Ssl,Https,我想将我网站的每个url从http://重定向到https:// 我的问题是,我的.htaccess中有一个路由系统: RewriteRule ([^.]+)\.html$ index.php?/$1 [QSA,L] 我试图添加此内容,但路线中断: RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 有人能帮我吗 谢谢 在旧规则之前将HTTP添加到HTTPS: RewriteCond

我想将我网站的每个url从http://重定向到https://

我的问题是,我的.htaccess中有一个路由系统:

RewriteRule ([^.]+)\.html$ index.php?/$1 [QSA,L]
我试图添加此内容,但路线中断:

RewriteCond %{HTTPS} off    
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
有人能帮我吗


谢谢

在旧规则之前将HTTP添加到HTTPS:

RewriteCond %{HTTPS} off    
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]

RewriteRule ([^.]+)\.html$ index.php?/$1 [QSA,L]

我发现了好的陈述:

RewriteCond %{SERVER_PORT} !443
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]

路由是如何中断的?谢谢,它在我的开发环境(MAMP)上工作,但在我的测试环境(服务器)上它会导致重定向循环!https证书或服务器配置没有问题吗?我问管理员,但不幸的是,他要到下周才能使用。当我知道更多的时候,我会回来的。