i rewrite all non-www requests to www with:
我用www重写所有非www请求到www:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.de$
RewriteRule ^(.*)$ http://www.mydomain.de/$1 [L,R=301]
But... this doesn´t work with https, so I also want all https requests without www to https with www. Example:
但是......这不适用于https,所以我也希望所有https请求没有www到https与www。例:
https : // mydomain . de --> https : // www . mydomain . de
https://mydomain.de/example --> https://www.mydomain.de/example
Con someone help me here? Thanks in Advance!
骗人有人帮我吗?提前致谢!
1 个解决方案
#1
3
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]
This will perform:
这将执行:
- https => https with www rewrite
- https => https with www rewrite
- http => http with www rewrite
- http => http改为www重写
#1
3
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]
This will perform:
这将执行:
- https => https with www rewrite
- https => https with www rewrite
- http => http with www rewrite
- http => http改为www重写