html - XAMPP:访问根目录子目录中的html页面

标签 html windows apache xampp

这很可能是初学者的问题,但我似乎无法在任何地方找到解决方案,并且我发现的几篇处理该问题的帖子都没有得到解答(例如 xampp in window 7 cannot access files in subfolder inside C:/xampp/htdocs )。

到目前为止,我有一个使用 XAMPP 的工作本地主机(必须将端口更改为 8080),位于自定义文档根目录中。我可以加载index.html,但是当我单击指向子目录的链接时:

<li><a href="examples/test.html"></a></li>

我收到以下错误:

Service unavailable!

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

If you think this is a server error, please contact the webmaster.

Error 503

localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30

即使我直接在浏览器中输入地址( http://localhost:8080/examples/test.html ),也不起作用。

有人可以指出这是否有效吗?或者我是否应该在 apache 配置文件中指定一些内容?

我还可以注意到,当简单地在浏览器中查看 html 文件(在本地主机之外)时,页面可以正常工作并加载,无论它们在目录中的位置如何。感谢您的帮助!

编辑: 这是我修改后的conf文件DocumentRoot部分:

#DocumentRoot "F:/Apps/xampp/htdocs"

DocumentRoot "F:/me/GitWorkDir/myproject_io"


<Directory "F:/me/GitWorkDir/myproject_io">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

最佳答案

事实证明,这个问题是由于一个不幸的巧合导致子目录无法被准确地称为“示例”...... 看这个page其中讨论了该问题并提出了解决方案。

简而言之,您可以:

  1. 转到文件 C:\xampp\apache\conf\extra\httpd-ajp.conf 并添加“#”来注释掉冲突的行: ProxyPass/examples ajp://127.0.0.1:8009/examples smax=0 ttl=60 retry=5
  2. 或者简单地以不同的方式重命名“examples”目录(例如 example2)

关于html - XAMPP:访问根目录子目录中的html页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42038477/

相关文章:

html - 防止水平滚动,溢出属性不起作用

jquery - 在合理的画廊布局中图像中间的中心图标

windows - 从 Windows Server 2008 在 Linux 上执行管理任务

c++ - 实时键盘输入到控制台(在 Windows 中)?

php - 无法正确安装XAMPP或无法启动apache和mysql

python - 在 Windows 上使用 Mod_WSGI 的 Flask 应用程序将无法运行 - 现在 URLS 将无法工作

apache - XAMPP : Connecting to localhost fix? [持久]

Javascript 改变 iframe 内的值

javascript - 如何查找数组中不匹配的数字?

windows - Perl 不接收命令行参数?