11 lines
356 B
ApacheConf
11 lines
356 B
ApacheConf
RewriteEngine On
|
|
|
|
# If behind reverse proxy (some shared hostings), trust X-Forwarded-Proto
|
|
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
|
|
RewriteCond %{HTTPS} !=on
|
|
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
|
|
|
# Force non-www on already HTTPS URL
|
|
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
|
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
|