OS

2022.02.16 14:41

apache http => https 리다이렉션

  • 비아웹 오래 전 2022.02.16 14:41 인기
  • 4,514
    0

http 접속시 https 접속으로 전환 시키는 방법 중 apache 에서 설정하는 방법

설정 방법

<VirtualHost *:80> DocumentRoot "/home/viaweb/html" ServerName www.viaweb.co.kr RewriteEngine On RewriteCond %{HTTPS} off RewriteRule(.*) https://%{HTTP_HOST}%{REQUEST_URI}[R=301,L]</VirtualHost>

설명

RewriteEngine On : rewrite On

RewriteCond %{HTTPS} off : https 접속시에는 미동작

off 대신 !on 사용 가능

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

R=301 : 영구 리다이렉션

L : 마지막라인, 생략 가능, 해당 라인 아래의 rewrtie 설정은 동작하지 않음

RewriteRule (.*)https://%{HTTP_HOST}/$1 [R=301,L] 설정해도 됩니다.

감사합니다.

서버호스팅 비아웹

  • 공유링크 복사

    댓글목록

    등록된 댓글이 없습니다.