programing

Apache에서 vue 기록이 있는 https 강제 적용

prostudy 2022. 5. 4. 21:32
반응형

Apache에서 vue 기록이 있는 https 강제 적용

vue.js 기록의 apache에서 .htaccess를 통해 https 연결을 강제 적용:

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>

SSL 연결을 강제 적용하도록 이 .htaccess를 수정하려면 어떻게 해야 하는가?

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>

이것은 오래된 질문이지만, 내가 vue에서 ssl을 강제하기 위해 사용하고 있는 것은 이것이다.

<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>

참조URL: https://stackoverflow.com/questions/48058494/force-https-with-vue-history-in-apache

반응형