我想重定向 https://www.example.com 到的 http://www.example.com 。我尝试以下code在.htaccess文件
I'm trying to redirect https://www.example.com to http://www.example.com. I tried the following code in the .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
这code成功重定向 https://example.com 到的 http://www.example.com 。在然而,当我键入 https://www.example.com 然后它给了我一个找不到网页在浏览器中的错误。
This code successfully redirects https://example.com to http://www.example.com. However when I type in https://www.example.com then it gives me a "web page not available" error in the browser.
我也曾尝试以下2 codeS没有成功
I have also tried the following 2 codes without success
尝试1
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*):NOSSL$ http://www.example.com/$1 [R=301,L]
尝试2
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
两个以上尝试失败。有什么建议?
Both above attempts failed. Any suggestions?
尝试二是接近完美。只要修改悦目:
Attempt 2 was close to perfect. Just modify it sightly:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]