【问题标题】:Directory 'static' gives 404 error目录“静态”给出 404 错误
【发布时间】:2015-11-08 05:56:10
【问题描述】:

在运行 XAMPP 的 Windows 机器上,我的 Web 根目录中有一个名为“static”的文件夹。即使文件夹存在,它和其中的所有内容都会返回 404 错误。

如果我更改文件夹的名称,例如'静态',一切都很好。我有其他运行 Apache 的服务器 (Ubuntu),我没有这个问题。

该站点是我们的一台 Linux 服务器上的其中一个站点的副本。我可以做什么或更改以允许目录按命名方式工作?

编辑 vhosts.conf

<VirtualHost *:8080>
    ServerAdmin jablanchard@foo.com
    DocumentRoot "C:/xampp/htdocs/home/app/gateway"
    ServerName localhost
    ServerAlias 127.0.0.*
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>

<Directory C:/xampp/htdocs/home/app/gateway/>
    # allow .htaccess overrides to work
    AllowOverride All
    DirectoryIndex login.html index.html index.php
</Directory>

# this matches a link to any project directory to the physical webui directory
AliasMatch ^/projects/([-\w]*)/(.*)$ /home/src/gateway/webui/$2
<Directory /home/src/gateway/webui>
    DirectoryIndex home.html
    Options All
    AllowOverride All
    Require all granted
</Directory>

【问题讨论】:

  • 文件夹的完整路径是什么?静态的
  • 在您的 apache 配置中没有对 /static 进行特殊处理?
  • 你能告诉我们你的虚拟主机吗?
  • 我已经添加了虚拟主机文件@Sculper

标签: apache xampp


【解决方案1】:

我正准备重新安装 XAMPP,但最后一次通过了 Apache 的配置文件。我发现问题出在 httpd.conf 文件中的这段代码 -

Alias "/static" "C:/xampp/htdocs/static"
<Directory "C:/xampp/htdocs/static">
    AllowOverride All
    Require all granted
</Directory>

我不确定这是否是 XAMPP 安装的一部分,因为我对此安装所做的所有编辑都在 vhosts 文件中。注释掉静态目录后,正如我定义的那样,现在可以正常工作了。

【讨论】:

    猜你喜欢
    • 2012-10-02
    • 2018-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-25
    • 2011-07-06
    • 1970-01-01
    • 2017-10-16
    相关资源
    最近更新 更多