我有一个Wordpress安装。我的网址在Wordpress中配置为"https://example.com“。由于我只想提供一个安全的连接,所有的http://example.com请求都会通过我的.htaccess中的以下代码自动重定向到https-域:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]此代码片段位于标准Wordpress代码片段之前。它可以工作,但我不能在"example.com“之前使用www。所以Google Chrome给了我一个"ERR_TOO_MANY_REDIRECTS“错误。
谢谢你的帮助。非常感谢!
发布于 2019-04-23 02:56:25
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]在您的.htacess文件上使用它。如果有效,请让我知道
https://stackoverflow.com/questions/55799149
复制相似问题