2013-09-25 387 views
0

我重寫了所有非www請求到www:HTTPS非WWW訪問https WWW

RewriteCond %{HTTP_HOST} !^www\.mydomain\.de$ 
RewriteRule ^(.*)$ http://www.mydomain.de/$1 [L,R=301] 

但是...... 以https這種doesn't工作,所以我也想加www所有HTTPS請求https與www。 例如:

https : // mydomain . de --> https : // www . mydomain . de 
https://mydomain.de/example --> https://www.mydomain.de/example 

有人幫我嗎? 在此先感謝!

回答

3

您可以使用此代碼:

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

這將執行:

  • HTTPS => HTTPS以www改寫
  • HTTP => HTTP以www改寫
相關問題