我正在尝试在生产apache服务器中强制执行https,同时仅将根路由'/'重定向到子文件夹'/ front',因此重定向到子文件夹工作正常,但不是https强制。
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^$ /front [L]
RewriteCond %{HTTP_HOST} !=localhost [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R]
答案 0 :(得分:0)
我终于找到了解决方案:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
DirectoryIndex /front/index.html
RewriteCond %{HTTP_HOST} !=localhost [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R]