更新时间:2023-10-21 17:13:22
您不能强制子文件夹或子域重定向到https
You can't force subfolder or subdomain to redirect to https
要进行https重定向,请仅使用
for https redirection just use this
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
对于子文件夹
RewriteRule ^/?(.*) https://%{SERVER_NAME}/home/$1 [R,L]
还可以使用默认的.htaccess进行重定向
also you can use the default .htaccess for redirection
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>