This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# force HTTPS and www. | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L] | |
# alternative way | |
RewriteCond %{HTTP_HOST} !^$ | |
RewriteCond %{HTTP_HOST} !^www\. [NC] |