![网站对我来说运行正常,但其他人却收到 ERR_TOO_MANY_REDIRECTS](https://linux22.com/image/743368/%E7%BD%91%E7%AB%99%E5%AF%B9%E6%88%91%E6%9D%A5%E8%AF%B4%E8%BF%90%E8%A1%8C%E6%AD%A3%E5%B8%B8%EF%BC%8C%E4%BD%86%E5%85%B6%E4%BB%96%E4%BA%BA%E5%8D%B4%E6%94%B6%E5%88%B0%20ERR_TOO_MANY_REDIRECTS.png)
我有以下 Apache 配置文件:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example/public
<Directory /var/www/html/example>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.example.com
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,NE,R=301]
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example/public
<Directory /var/www/html/example>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,NE,R=301]
</VirtualHost>
</IfModule>
我试图实现的是将所有调用重定向到非 WWW HTTPS,这对我来说是可行的,网站加载正常,所有重定向都按预期工作。然而,当我使用不同的速度测试工具(例如 Google 自己的工具或任何代理)测试网站速度时,他们只是返回ERR_TOO_MANY_REDIRECTS
。我甚至请几个人尝试该网站,他们也遇到了同样的错误。
有人知道这可能是什么原因造成的吗?