nugawiki Archive of experience and knowledge

./categories/server

HTTPS·www 리다이렉트 (mod_rewrite)

업데이트 2026-07-21 조회수

HTTP→HTTPS (301)

Bitnami 예: /home/bitnami/apps/wordpress/conf/htaccess.conf

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
</IfModule>

HTTPS + www 제거 (apex로 통일)

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [OR]
    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
</IfModule>

결과: http(s)://www.example.com · http://example.comhttps://example.com

Bitnami 재시작:

sudo /opt/bitnami/ctlscript.sh restart
  • 301: 영구(서버단, SEO)
  • 302: 일시(앱/JS)

./comments