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 - Fatal编程技术网

.htaccess 将整个站点从http重定向到https,一个页面除外

.htaccess 将整个站点从http重定向到https,一个页面除外,.htaccess,.htaccess,我想把我的整个网站从http重定向到https,除了一个页面(实际上是一个要下载的文件),但我遇到了麻烦 我目前正在使用 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_

我想把我的整个网站从http重定向到https,除了一个页面(实际上是一个要下载的文件),但我遇到了麻烦

我目前正在使用

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
从这个帖子

但是我还没有弄清楚如何排除我需要的一个文件

差不多

我试着将它的https版本重定向回http版本,但我得到了一个错误,它表明我处于一个无休止的解析循环中,无法工作


任何帮助都将不胜感激

一个简单的mod_重写异常应该可以工作:

RewriteEngine On
RewriteCond %{REQUEST_URI} !/phone/version/currentversion.txt
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

没问题。听到这个消息我很高兴。:)