.htaccess 如何为*.example.com强制使用https?
如何为*.example.com强制使用https 我试过:.htaccess 如何为*.example.com强制使用https?,.htaccess,.htaccess,如何为*.example.com强制使用https 我试过: RewriteCond %{HTTPS} !=on RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L] 我想你会在那里找到答案:确保你已经安装了mod_rewrite,这应该适合你: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
我想你会在那里找到答案:确保你已经安装了mod_rewrite,这应该适合你:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
如果要为某些子域执行此操作:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\. [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]