首页 > 解决方案 > 启用 SSL 和 http 重定向时出现错误的请求错误

问题描述

我配置并启用了 SSL,一切正常。但是在启用从 http 到 https 的重定向后,打开网站时出现以下错误:

Bad Request
Your browser sent a request that this server could not understand.
Reason: You’re speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

我注意到这仅在通过mywebsite.com在浏览器搜索栏上键入访问该站点时发生,当我访问它时,URL 显示如下:http://mywebsite.com:443/

如果我删除 :443 部分,它可以正常工作并重定向到 https。

我怎样才能使它在从浏览器访问时不会转到错误的 url?目前,我已禁用重定向以避免我的客户试图返回该站点并收到该错误。

更新:

这是我使用的配置:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

在这里找到:https ://docs.bitnami.com/bch/apps/wordpress/administration/force-https-apache/

标签: httpsslapache2lets-encryptbitnami

解决方案


推荐阅读