2015-11-03 50 views
0

我想重定向到https://example.comhttps://www.example.com寫入規則和SSL不工作

如果我去https://example.com/aboutus

也應該重定向到https://www.example.com/aboutus

目前,我在.htaccess這個,但它使ssl證書消失。

RewriteCond %{HTTPS} off 
RewriteCond %{DOCUMENT_ROOT}/../.force_ssl -f 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteCond %{HTTPS}s ^on(s)| 
RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

回答

0

剛剛嘗試這條規則在您的.htaccess的頂部:

RewriteEngine On 

RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteCond %{HTTPS}s ^on(s)| 
RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

確保清除瀏覽器緩存。