将用户的每个请求重定向到我服务器上的任何页面的正确 .htacess 规则是什么https://that page
例如,mydomain.com
或者http://mydomain.com
会去https://mydomain.com
另外,mydomain.com/projects/1.html
会去https://my domain.com/projects/1.html
无论请求有多深,来自浏览器的所有请求都会https://that location.
我该怎么做?
If you are using Apache, you need to use mod_ssl by using the SSLRequireSSL Directive. then you need to use mod_rewrite for a redirection.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteEngine on
RewriteRule (.*) https://mydomain.tld$1
确保虚拟主机位于不同的文件夹中,因此它不会明显递归。