我正在尝试将所有HTTP请求重定向到HTTPS,并将所有www重定向到非www URL.
I'm trying to redirect all HTTP requests to HTTPS and all www to non-www URLs.
也就是说,
我成功地能够重定向URL条件(1、2和3),但是第4个重定向条件不起作用,即 www.example 到 example .
I was successfully able to redirect URL conditions (1, 2 & 3) but the 4th redirect condition does not work, i.e. www.example to example.
我为我的网站的www和非www URL都具有SSL证书.我当前正在使用WordPress.
I have an SSL certificate for both www and non-www URLs for my website. I'm currently using WordPress.
我的.htaccess文件包含以下代码:
My .htaccess file contains the following code:
RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC] RewriteRule (.*) %1%{REQUEST_URI} [L,R=301]我尝试了许多不同的重定向条件,但是没有一个起作用.
I've tried many different redirect conditions but none worked.
我在Firefox中收到以下错误:
I get the following error in Firefox:
在连接到www.example时发生错误.对等方报告它遇到内部错误.错误代码:SSL_ERROR_INTERNAL_ERROR_ALERT
An error occurred during a connection to www.example. Peer reports it experienced an internal error. Error code: SSL_ERROR_INTERNAL_ERROR_ALERT
我该怎么做才能重定向第四个URL条件?
What can I do to redirect the 4th URL condition?
推荐答案我终于找到了解决问题的方法.是CloudFare,我使用的是免费版本.
I finally found the solution to the problem. It is CloudFare, I was using the free version.
通过Cpanel为我的网站关闭cloudfare可使所有重定向正常工作.
Turning off cloudfare for my website from Cpanel made all the redirects work.
更多推荐
将HTTP重定向到HTTPS并将WWW重定向到NON
发布评论