我有一个在Raspberry pi 3上运行的WAMP安装.Apache v2.4.33,php 7.2.4。
我想要我的网站的默认网址 - “//www.quintic.co.uk/” - 实际上要解决“//www.quintic.co.uk/index.php?home”。所以我在.htaccess文件中添加了以下内容:
DirectoryIndex index.php?home
我还通过使用以下内容更新apache配置文件,将Apache配置为始终使用https协议:
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剪切并粘贴到浏览器中,则主页返回正常。
任何人都可以了解为什么默认网址重定向不适用于https。
谢谢
SteveD430
问题出在apache2.conf中。在Quintic网站的“目录”元素中。我有以下内容:
AllowOverride None
Order allow,deny
allow from all
Require all granted
它需要是AllowOverride All
网站现在运作良好。