【问题标题】:V hosts issue - Couldn't load webpage - Keep loading but no resultV 主机问题 - 无法加载网页 - 继续加载但没有结果
【发布时间】:2021-11-28 11:21:31
【问题描述】:

我正在尝试使用虚拟主机建立一个本地网站。 我正在开发 Mac big sur 11.6 - Mamp 6.3 /apache。 下面是文件的配置:/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/Users/THE_USER/sites/symfart/public/"
ServerName  symfart.local
</VirtualHost>

这里是文件 /etc/hosts 的配置: 127.0.0.1 本地主机 255.255.255.255 广播主机 ::1 本地主机 127.0.0.1 symfart.local

我已经更新了文件 /Applications/MAMP/conf/apache/httpd.conf 并取消注释 2 行: LoadModule vhost_alias_module 模块/mod_vhost_alias.so 和 包括 /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

没有错误>页面保持加载并且没有结果(就像一个无限循环) 谢谢你的帮助

【问题讨论】:

    标签: apache mamp virtualhost vhosts


    【解决方案1】:

    经过研究,我发现我在 Public 文件夹中缺少一个 .htaccess 文件。 这是它的内容:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Determine the RewriteBase automatically and set it as environment variable.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    
    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]
    
    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/index.php [L]
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-26
      • 2018-05-01
      • 2019-04-26
      • 1970-01-01
      • 2023-01-08
      • 2013-08-13
      • 1970-01-01
      • 2017-07-03
      相关资源
      最近更新 更多