【问题标题】:Laravel 5.3 redirect to https redirected you too many timesLaravel 5.3 重定向到 https 重定向你太多次
【发布时间】:2016-10-31 11:09:01
【问题描述】:

我刚刚在我的服务器上安装了 https,如果我将重定向添加到我的非 https 虚拟主机,我会收到页面重定向您太​​多次的错误。 如果我将它添加到我的 htaccess 中,同样的错误。

带有重定向的完整 htaccess:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

有什么想法吗?

谢谢!

【问题讨论】:

  • 某事可能处于无限循环中。

标签: php .htaccess laravel mod-rewrite


【解决方案1】:

查看浏览器调试器的网络面板,并将日志设置为不清除(Preserve log Chrome 中的复选框,Settings > Common > Enable persistent 在 Firefox 中) .现在清除您的缓存,访问所需的 URL 并查看您实际从服务器获得的响应。它至少应该为您提供有关您从每个响应的 Location 标头中获得的重定向的更多信息,并帮助您找到来源。

【讨论】:

    猜你喜欢
    • 2019-02-21
    • 1970-01-01
    • 2016-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-21
    • 2018-12-15
    相关资源
    最近更新 更多