.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개
답변을 작성하려면 로그인이 필요합니다.
로그인
참고해서 자바로 꼼수처리했습니다^^;