HTTPS 강제 리다이렉트
HTTP 트래픽 HTTPS로 301 리다이렉트 시킴
HTTPS 강제 리다이렉트 (.htaccess)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
.htaccess 파일에 위 내용 추가. HTTP 요청 들어오면 HTTPS로 301 리다이렉트 시킴. SSL 설치 후 적용 확인 필요.
여기서 배울 것
- .htaccess 파일로 HTTP -> HTTPS 강제 전환 가능.
- RewriteEngine On으로 리라이트 모듈 활성화.
- RewriteCond %{HTTPS} off 조건으로 HTTPS 아닐 때만 적용.
- [L,R=301] 플래그로 영구 리다이렉트 처리.
원본 파일 보기 (.claude/skills/tn-force-https-htaccess/SKILL.md)
---
name: HTTPS 강제 리다이렉트 (.htaccess)
description: This skill should be used when the user asks to force HTTP traffic to HTTPS using an .htaccess file, or when they need to implement a 301 redirect for HTTPS on an Apache server after SSL installation.
version: 1.0.0
source: /home/son/prj/resume/backup_notes_260317/notion/Tech Note/https , htcaccess b2dcd58aacf24aad9bb53d1a8fe1f468.md
---
# https , htcaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
.htcaccess
after install ssl, check it.