HTTPS非WWW到https WWW [英] https non www to https www
本文介绍了HTTPS非WWW到https WWW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我重写所有非www请求到www有:
i rewrite all non-www requests to www with:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.de$
RewriteRule ^(.*)$ http://www.mydomain.de/$1 [L,R=301]
不过... 以https这种doesn't工作,所以我也希望所有的HTTPS请求加www到https以www。 例如:
But... this doesn´t work with https, so I also want all https requests without www to https with www. Example:
https : // mydomain . de --> https : // www . mydomain . de
https://mydomain.de/example --> https://www.mydomain.de/example
体质有人能帮助我吗? 在此先感谢!
Con someone help me here? Thanks in Advance!
推荐答案
您可以使用此code:
You can use this code:
## 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重写
这篇关于HTTPS非WWW到https WWW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文