WEB

아파치 분산설정파일 htaccess로 http로 요청 시 https로 변경하기

어린왕자악꿍 2021. 4. 13. 16:11

사용자가 http://www.domain.com으로 브라우저에서 웹페이지에 접근 시 자동으로 https://www.domain.com으로 요청하려고 한다.

 

[.htaccess]

 

<IfModule mod_rewrite.c>

 RewriteEngine On

 RewriteBase /

 RewriteCond %{SERVER_PORT} 80

 RewriteRule ^(.*)$ https://domain.com/$1 [R,L]

 RewriteCond $1 !^(index\.php|images|captcha|assets|robots\.txt)

 RewriteCond %{REQUEST_FILENAME} !-f

 RewriteCond %{REQUEST_FILENAME} !-d

 RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>