.htaccess http접속시 https로 강제접속하기

.htaccess http접속시 https로 강제접속하기

QA

.htaccess http접속시 https로 강제접속하기

본문

한글 도메인 http접속시 https로 강제로 s붙이기나
www.우리나라.com으로 접속시 www 강제 제거 하기
둘중 하나가 되어야 하는데요.

 

아래처럼 방법을 여러가지 해봤는데 먹히질 않네요.
좋은 밥법 아시는 분 계시면 도움 좀 부탁드립니다.
호스팅은 카페24이고 그누보드 설치가 아닌 일반 html홈페이지입니다.

 

방법1
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

 

방법2
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

방법3
RewriteEngine on
RewriteCond %{HTTP_HOST} [a-zA-Z0-9.-]*xn--t60b60kopbh5w7hmz1c.com$ [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}:443%{REQUEST_URI}

 

방법4
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

 

방법5
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]


www 제거하기1
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]

 

www 제거하기2
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

이 질문에 댓글 쓰기 :

답변 2

https://www.happyjung.com/lecture/102  요기 내용 참고해서 해보세요

https://sir.kr/g5_tip/15414

요방법을 사용해보세요

답변을 작성하시기 전에 로그인 해주세요.
전체 123,122 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT