.htaccess http를 https로 redirect

.htaccess

.htaccess = hypertext access

웹 서버가 지원하는 디렉터리 수준의 설정파일

Apache에서 주로 사용

www폴더에 존재

redirect

http로 접속시 자동으로 https 프로토콜로 전환

해당 URL로 이동시켜주는 역활

방법

.htaccess 파일 수정

1
2
3
4
5
6
7
8
9
10
11
12
13
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

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

RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

에러

쿠키 어쩌고 하면서 안되는 경우

firefox기준

이 문제는 드물게 해당 사이트에서 요구하는 쿠키를 차단하여 발생할 수 있습니다.

index 이름을 갖고 있는 파일이 여러개인 경우 정확한 파일을 찾지 못하여 문제가 발생 할 수 있음

사용하는 index.html 하나만 위치시키면 해결

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×