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 URL重定向到HTTPS页面_.htaccess - Fatal编程技术网

.htaccess 将HTTP URL重定向到HTTPS页面

.htaccess 将HTTP URL重定向到HTTPS页面,.htaccess,.htaccess,有人能帮我吗 我已设法重定向根访问。当有人使用sample.com访问我的网站时,它将重定向到,但当有人使用sample.com/blog这种方法访问网站时,它仍会加载“不应该”的内容。以下内容在我的大多数项目中都适用: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domain.com/$1 [L] 以下内容位于网站根HTML文件夹中的.htaccess中。在此规则之后放置其他重写规

有人能帮我吗


我已设法重定向根访问。当有人使用sample.com访问我的网站时,它将重定向到,但当有人使用sample.com/blog这种方法访问网站时,它仍会加载“不应该”的内容。以下内容在我的大多数项目中都适用:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]
以下内容位于网站根HTML文件夹中的
.htaccess
中。在此规则之后放置其他重写规则


编辑:此
RewriteCond
要求HTTP在标准端口80上运行。如果您通过其他端口传输HTTP,请调整它。

您在htaccess中设置的规则是什么?这一个重写引擎在RewriteCond%{HTTPS}上关闭RewriteRule(.*)HTTPS://%{HTTP_HOST}%{REQUEST_URI}当有人访问我的网站,比如sample.com,它会被重定向到,但当添加了像sample.com/blog这样的内容时,它仍然会使用http://protocolDoes
/blog/
还有一个.htaccess?