【发布时间】:2023-01-26 20:32:49
【问题描述】:
我现在有两个域:example.pl 和 example.com。
我试图确保它们都分别转到https://example.pl 或http://example.com,但我遇到了问题(或者我的浏览器还记得旧状态)。
我现在有这段代码:
RewriteCond %{ENV:HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^example.pl [NC]
RewriteRule ^ https://example.pl%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{ENV:HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,NE,R=301]
但我不确定它是否正常工作(http://example.com 以某种方式重定向到https://example.pl)以及这是否可以在一个代码块中完成?
【问题讨论】:
标签: .htaccess