본문 바로가기
Apache

.htaccess http를 https 리다이렉트 rewrite

by 씨엔아이소프트 2021. 11. 10.
반응형

홈페이지 상단에 .htaccess 파일을 이용하여, http 를 https 로 자동 변환되게 한다.

 

<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</ifmodule>

 

참고로 웹서버에서 https 로 리다이렉트 하려면 VirtualHost에 아래와 같이 한줄 추가해주면 된다.

 

Redirect / https://cnisoft.tistory.com

반응형

댓글