我试图通过我的.htaccess
将我的XAMPP服务器上的HTTP重定向到HTTP来禁用HTTPS,但我无法这样做。当我在stackoverflow找到同一个问题的答案时,我看了很多。由于我可以完全访问我的XAMPP,因此我去编辑了httpd-ssl.conf并注释掉了虚拟主机部分,但是我的apache在此之后拒绝启动。之后我在httpd.conf中注释了Include conf/extra/httpd-ssl.conf
,它允许我的apache启动,但我仍然无法将HTTPS重定向到HTTP。该页面不断加载不间断。
以下是我htaccess
的样子:
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
我认为我面临的问题可能是我注释掉了整个SSL文件,所以这里是我试图在httpd-ssl.conf
中注释掉的行
<VirtualHost _default_:443>
# General setup for the virtual host
DocumentRoot "C:/xampp/htdocs"
ServerName www.example.com:443
ServerAdmin admin@example.com
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
我也尝试设置SSLEngine off
并启动Apache,但当我尝试加载网站时,我开始收到ERR_SSL_PROTOCOL_ERROR
。
编辑:日志
在我启动Apache后,在Include conf/extra/httpd-ssl.conf
中注释掉httpd.conf
会在我的error.log中产生[ssl:warn] [pid 5440:tid 364] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
。
在我的httpd-ssl.conf
中注释掉虚拟主机部分会导致error.log中没有错误,但我在xampp-control中得到了这个:
[Apache] Error: Apache shutdown unexpectedly.
[Apache] This may be due to a blocked port, missing dependencies,
[Apache] improper privileges, a crash, or a shutdown by another method.
[Apache] Press the Logs button to view error logs and check
[Apache] the Windows Event Viewer for more clues
[Apache] If you need more help, copy and post this
[Apache] entire log window on the forums
启动Apache后,设置SSLEngine off
会在我的error.log中生成[ssl:warn] [pid 2276:tid 388] AH01916: Init: (www.example.com:443) You configured HTTP(80) on the standard HTTPS(443) port!
。