【发布时间】:2012-10-11 13:59:09
【问题描述】:
我正在尝试将https://www.example.com 重定向到http://www.example.com。我在 .htaccess 文件中尝试了以下代码
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
此代码成功地将https://example.com 重定向到http://www.example.com。但是,当我输入 https://www.example.com 时,它会在浏览器中显示“网页不可用”错误。
我也试过以下2个代码都没有成功
尝试 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}
以上两次尝试都失败了。有什么建议吗?
【问题讨论】:
标签: apache .htaccess http https