在apache中使用vue历史强制https

nex*_*equ 2 .htaccess vue.js vuejs2

我想通过apache中的.htaccess强制https连接vue.js历史记录:

Vue历史记录需要.htaccess像这样:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.html$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.html [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

如何修改此.htaccess以强制SSL连接?

Sol*_*eno 5

第3行和第4行用于重定向到https.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)