Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
Apache htaccess错误导致循环_Apache_.htaccess_Mod Rewrite_Ssl - Fatal编程技术网

Apache htaccess错误导致循环

Apache htaccess错误导致循环,apache,.htaccess,mod-rewrite,ssl,Apache,.htaccess,Mod Rewrite,Ssl,我试图在HTACCESS文件上强制使用SSL,所有的努力都会导致index.php上出现一个循环 这是我的访问权限 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php

我试图在HTACCESS文件上强制使用SSL,所有的努力都会导致index.php上出现一个循环

这是我的访问权限

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]
</IfModule>

重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
我的站点可以很好地使用它,但没有SSL

我尝试了以下方法:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)$ https://www.fakedomainlollol.com/$1 [R,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]
</IfModule>

重新启动发动机
重写基/
重写规则^(.*)$https://www.fakedomainlollol.com/$1[R,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
更新后的重写规则以循环方式发送站点


错误是什么?我做错了什么?

您的第一条规则是将https重定向到https,这就是为什么循环。将这一行放在规则RewriteCond%{https}^off$上方,以便只有http请求可以路由到https,而不是https=>https。