./categories/server
HTTPS·www 리다이렉트 (mod_rewrite)
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.com → https://example.com
Bitnami 재시작:
sudo /opt/bitnami/ctlscript.sh restart
- 301: 영구(서버단, SEO)
- 302: 일시(앱/JS)
./comments