【问题标题】:Laravel: Redirect to https://www.*** does not work in Firefox?Laravel:重定向到 https://www.*** 在 Firefox 中不起作用?
【发布时间】:2018-07-28 07:23:52
【问题描述】:

我在 .htaccess 文件中添加了此代码 https://stackoverflow.com/a/13997498/2311074,以始终将我的网站重定向到 https://www.**********。这适用于 Chrome,但不适用于 Firefox。

如果我进入

https://example.com

然后它不会重定向到任何地方。

在火狐中。在 Chrome 中,它们被正确重定向到 https://www.example.com

我已经删除了缓存并尝试从其他 PC 调用该网站,但仍然无法正常工作。这是我来自 Laravel 的 htaccess 文件:

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

    RewriteEngine On


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

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

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

    RewriteCond %{HTTPS} off
    # First rewrite to HTTPS:
    # Don't put www. here. If it is already there it will be included, if not
    # the subsequent rule will catch it.
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    # Now, rewrite any request to the wrong domain to use www.
    # [NC] is a case-insensitive match
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

我做错了什么?

【问题讨论】:

  • 你在火狐的隐私模式下试过了吗?
  • @Karolis 是的,在私人模式和其他电脑(Windows 7 和 ubuntu)上。重定向仍在发生,网址是coaching-institutes.net

标签: php .htaccess laravel-5


【解决方案1】:

问题是我只有域 www.example.org 的 SSL 证书,但没有域 example 的 SSL 证书.org。因此 url https://example.org 无效,未加载且无法使用 .htaccess 文件重定向。

【讨论】:

    【解决方案2】:

    有关问题的答案,请参阅下面的 cmets。

    【讨论】:

    • 所以你是说stackoverflow.com/questions/13977851/… 在firefox 中不起作用?
    • 确保您不仅为 https 安装了 SSL,还为 www 安装了 SSL。
    • prntscr.com/ig267b 在 Firefox 中为我工作的域,您必须为 https 安装了错误的证书
    • 我只为https://www.*** 安装了 SSL,这就是为什么我首先希望重定向到 www 页面
    • 如果您在浏览器中输入https://coaching-institutes.net,该域是否适合您?我也在其他 PC 上尝试过,但它无法正常工作
    猜你喜欢
    • 1970-01-01
    • 2021-04-15
    • 1970-01-01
    • 1970-01-01
    • 2017-06-21
    • 2020-02-03
    • 2016-05-24
    • 2018-10-24
    • 2017-01-11
    相关资源
    最近更新 更多