https 到 http 重定向

发布于 2024-11-10 13:44:30 字数 722 浏览 1 评论 0原文

我到处寻找,但仍然找不到任何答案。

我正在尝试将例如: https://www.domain.com 重定向到 http://www.domain.com

目前我有一个 .htaccess 文件,其中包括:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

但我不断收到以下内容错误:

An error occurred during a connection to www.domain.com.
SSL received a record that exceeded the maximum permissible length.
(Error code: ssl_error_rx_record_too_long)...

我需要在 VirtualHost *:443 的虚拟主机文件中添加任何内容吗?对于domain.com - 抱歉,对此很陌生。任何帮助/指导将不胜感激,谢谢!

I have searched everywhere and still can't find any answers.

I'm trying to redirect eg: https://www.domain.com to http://www.domain.com

Currently I have a .htaccess file which includes:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

But I keep receiving the following error:

An error occurred during a connection to www.domain.com.
SSL received a record that exceeded the maximum permissible length.
(Error code: ssl_error_rx_record_too_long)...

Do I need to add anything to my vhost file for VirtualHost *:443? for domain.com - Apologies, quite new to this. Any help/direction would be greatly appreciated, thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薯片软お妹 2024-11-17 13:44:30

您需要拥有完全正常工作的 https 虚拟主机。请在此处粘贴您的虚拟主机中的内容。

<VirtualHost IP:443>
    ServerName www.domain.com
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/www.domain.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.domain.key

    ReWriteEngine On
    RewriteRule (.*) http://www.domain.com%{REQUEST_URI}
</VirtualHost>

如果 http 和 https 使用相同的虚拟主机,事情可能会变得混乱。顺便说一句,您的证书必须具有 www.domain.com 的 CNAME,或者如果您有通配符 *.domain.com。还有一件事,您在这里不需要任何 RewriteCond 因为您重写了每个 https 请求。

You need to have fully working https vhost. Please paste here what you have in your vhost.

<VirtualHost IP:443>
    ServerName www.domain.com
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/www.domain.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.domain.key

    ReWriteEngine On
    RewriteRule (.*) http://www.domain.com%{REQUEST_URI}
</VirtualHost>

If you have the same vhost for http and https things can get messy. Btw your cert must have CNAME for www.domain.com or if you have wildcard *.domain.com. And one more thing, you don't need any RewriteCond here because you rewrite every https request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文