2017-03-15 54 views
0

我与此重定向目标是:htaccess的重定向不example.com的工作https://example.com

  • 的http:// - > https://开头
  • www.example.com - >example.com
  • example.com - >我目前使用我的.htaccess重定向以下https://example.com

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
RewriteRule^https://%1%{REQUEST_URI} [NE,R=301] 

RewriteCond %{HTTPS} !=on 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

这些规则对所有工作除下列要求: example.com - >example.com%7Brequest_uri%7Dhttps://example.com

做一些研究之后,可能这个问题是与SSL是如何设置?或者可能是主机服务器配置文件中的一些代码?

回答

0

试试这个规则从非HTTPS重定向到https:

RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]