【问题标题】:MAMP on Mac redirects virtual localhost to httpsMac 上的 MAMP 将虚拟 localhost 重定向到 https
【发布时间】:2018-12-02 20:34:15
【问题描述】:

Chrome 版本:67.0.3396.87

网络服务器:Apache

当我点击 http://www.assignmenthelpdesk.local 时,它会重定向到 https://www.assignmenthelpdesk.local/

如何阻止 MAMP 重定向到 https?提前致谢。

/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 详情如下:

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs/AssignmentHelpDesk
    ServerName www.assignmenthelpdesk.local
</VirtualHost>

/etc/hosts 详细信息

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
127.0.0.1       www.assignmenthelpdesk.local
255.255.255.255 broadcasthost
::1             localhost

/Applications/MAMP/conf/apache/httpd.conf 详情如下:

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

【问题讨论】:

  • 尝试将 "::1 localhost" 行放在评论部分,你是否重启了你的 MAMP?
  • 您清除浏览器缓存了吗?所有设置都正确,应该可以工作。

标签: apache localhost mamp virtualhost macos-high-sierra


【解决方案1】:

现在一切正常。

我只需要从 assignmenthelpdesk(本地文件夹)的 .htaccess 中删除以下两行

RewriteCond %{HTTPS} 关闭

重写规则 ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

【讨论】:

    猜你喜欢
    • 2016-07-16
    • 2016-12-09
    • 2020-06-16
    • 2020-12-28
    • 2020-12-12
    • 1970-01-01
    • 2017-09-13
    • 1970-01-01
    • 2019-08-13
    相关资源
    最近更新 更多