WampServer 和 XAMPPserver 自动将 http 重定向到 https(我不想要这个)

WampServer & XAMPPserver automatically redirecting http to https (I don't want this)

我新安装的 WampServer 3.1.0 64 位中的每个 http 站点都会自动将没有 .htaccess 的简单 index.html 文件重定向到 https 版本的网站。

我在 C:\wamp64\wwwC:\wamp64\www\example 中看不到 .htaccess 文件。

如果我卸载 WampServer,然后安装 XAMPPserver,会发生同样的事情。

感谢帮助。

httpd-vhosts.conf:

<VirtualHost www.superiorit.dev:80>
    ServerAdmin steve.doig@superiorit.com.au
    DocumentRoot "C:/xampp/htdocs/superiorit"
    ServerName www.superiorit.dev
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

httpd-ssl.conf: 是标准的默认文件。

我对 httpd.conf 所做的唯一更改是:

Listen 172.18.1.106:80

我注意到 Windows 任务栏中的 Chrome 图标看起来与正常的 Chrome 图标不同:

如果我在 Edge 中加载站点,则不会发生重定向。

在虚拟主机定义中,您还需要告诉 Apache 允许访问包含站点代码的目录,即 <Directory>

我最近还了解到 Google 拥有 .dev 顶级域名,因此您应该考虑使用其他东西,特别是如果您使用 Chrome 浏览器,因为 google 可以在其中添加任何内容以获取 .dev 的使用,好吧,做任何事情。

我现在发现从 V63 开始 Chrome 实际上会强制重定向 .dev

FF和其他浏览器也会出现这种情况

您也不需要在 <VirtualHost www.superiorit.dev:80> 行指定域名。 * 没问题。

所以试试这个,看看情况是否有所改善。

<VirtualHost *:80>
    ServerName superiorit.local
    ServerAlias www.superiorit.local
    DocumentRoot C:/xampp/htdocs/superiorit
    <Directory  "C:/xampp/htdocs/superiorit/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
    ErrorLog "logs/superiorit.local-error.log"
    CustomLog "logs/superiorit.local-access.log" common
</VirtualHost>

Also have a look at

AND https://tech.slashdot.org/story/17/09/18/192227/chrome-to-force-domains-ending-with-dev-and-foo-to-https-via-preloaded-hsts

您的问题是您的 .dev URL,就像 RiggsFolly 所建议的那样。这就是为什么它可以在其他浏览器(如 Edge)中运行的原因。这是 Chrome 63 附带的新功能。请参阅以下文章:

https://superuser.com/questions/1276048/starting-with-chrome-63-urls-containing-app-redirects-to-https https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/