【问题标题】:WampServer & XAMPPserver automatically redirecting http to https (I don't want this)WampServer & XAMPPserver 自动将 http 重定向到 https(我不想要这个)
【发布时间】:2018-05-25 18:24:00
【问题描述】:

我新安装的 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: 是标准的默认文件。

我对@9​​87654333@ 所做的唯一更改是:

Listen 172.18.1.106:80

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

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

【问题讨论】:

  • 很抱歉问的很明显,但是您启用了显示隐藏文件?
  • 是的,谢谢@DaveCarruthers。
  • 请向我们展示您的httpd-vhosts.conf 文件和您的httpd-ssl.conf 文件以及您对httpd.conf 文件所做的任何修改。如果httpd-vhosts.conf 文件中有错误,Apache 将回退到httpd-vhosts.conf 文件中定义的第一个虚拟主机
  • 谢谢@RiggsFolly,我已经添加了这些细节。

标签: https wampserver


【解决方案1】:

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

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

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

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

您也不需要在&lt;VirtualHost www.superiorit.dev:80&gt; 行上指定域名。 * 很好。

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

<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>

也可以看看Why all *.dev domains target to my localhost?

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

【讨论】:

  • @RiggsFolly 这个问题也出现在最新的 Firefox 版本中。因此,请相应地更新您的答案。
  • @user3733831 谢谢你的信息,你知道会发生这种变化的FF的版本号吗?
  • 我正在使用59.0.1 (64-bit)
【解决方案2】:

您的问题是您的 .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/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-28
    • 2019-02-12
    • 1970-01-01
    • 2017-03-17
    • 1970-01-01
    • 2019-05-15
    • 2021-03-31
    • 2021-09-10
    相关资源
    最近更新 更多