【问题标题】:https redirect with Apache is returning a blank page使用 Apache 的 https 重定向返回一个空白页面
【发布时间】:2019-03-18 18:36:09
【问题描述】:

我在 Raspberry pi 3 上运行 WAMP 安装。Apache v2.4.33,php 7.2.4。

我希望我的网站的默认 URL 地址 -“//www.quintic.co.uk/” - 实际地址为“//www.quintic.co.uk/index.php?home”。所以我在 .htaccess 文件中添加了以下内容:

DirectoryIndex index.php?home

我还将 Apache 配置为始终使用 https 协议,方法是使用以下内容更新 apache 配置文件:

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{SERVER_NAME}/$1 [END,NE,R=permanent]

在大多数情况下,以上所有内容似乎都运行良好。例如,如果我请求http://www.quintic.co.uk/,那么我将被重定向到https://www.quintic.co.uk/index.php?home

所有http请求都正确切换为https请求。 所有 https 请求都正确返回,https://www.quintic.co.uk/ 除外,它返回一个空白页。

https://www.quintic.co.uk/请求返回的实际指令集如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-eqiv="refresh" content="0" url="https://www.quintic.co.uk/index.php?home" />
<script type="text/javascript" src="https://ff.kis.v2.scr.kaspersky-labs.com/E989763D-7B5C-014A-B514-22905C3EEE53/main.js" charset="UTF-8"></script></head>
<body>
</body>
<!-- End of #container-->
<!--Scripts after page loads-->
</html>

如果我将 meta 语句中的 url 剪切并粘贴到浏览器中,主页会正常返回。

谁能解释一下为什么默认的 url 重定向不适用于 https。

谢谢

史蒂夫D430

【问题讨论】:

    标签: apache redirect https


    【解决方案1】:

    问题出在 apache2.conf 中。在 Quintic 网站的“目录”元素中。我有以下内容:

    AllowOverride None
    Order allow,deny
    allow from all
    Require all granted
    

    它必须是 AllowOverride All

    网站现在运行良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      • 1970-01-01
      • 2016-03-25
      相关资源
      最近更新 更多