[英]How to redirect website to https:// not redirect to https://www
[英]How do I redirect https:// to https://www on .htacess file?
我正在修改.htacess。 我试图改变https://mydomain.com到https://www.mydomain.com与下面的代码。 哪个失败了。
# REDIRECT HTTPS:// TO HTTPS://WWW.
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^my___domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.my___domain.com/$1 [R=301,L]
我究竟做错了什么?
作为一个说明:
如果这有帮助,将IP和原始3_ $(_“> http://my3_$.com)重定向到_”> http://www.3__$.com我在开头使用了这些代码,工作。
# REDIRECT IP TO WWW.
RewriteCond %{HTTP_HOST} ^xxx\.xxx\.xxx\.xxx
RewriteRule (.*) http://www.my___domain.com/$1 [R=301,L]
# REDIRECT HTTP:// TO HTTP://WWW.
RewriteCond %{HTTP_HOST} ^my___domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.my___domain.com/$1 [R=301,L]
我正在尝试重定向https://因为在成功修改上述两个之后,我无法登录,因为它们是https:// pages。
谢谢
而不是http://www.___.com/$1
,使用//www.___.com/$1
。 它将使用http或https,无论原始请求中使用哪个。 目前,你正在强迫http,这似乎与你想要的相反。
我使用这个重写从http
重定向到https
:
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
我想在你的情况下添加这样的东西可以完成这项工作:
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
嗯?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.