sc28 sc28 - 4 years ago 212
Apache Configuration Question

XAMPP: Accessing html pages in subdirectories of root

This is most likely a beginner's issue, but I can't seem to find the fix anywhere, and the few posts I found dealing with it are unanswered (e.g. xampp in window 7 cannot access files in subfolder inside C:/xampp/htdocs).

So far I have a working localhost using XAMPP (had to change the port to 8080), located in a custom document root. I can load the index.html, but when I click on a link towards a subdirectoy:

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

I get the following error:

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

Even if I type in the address (http://localhost:8080/examples/test.html) directly in the browser, it also doesn't work.

Could someone please indicate if this should be working? Or if I should specify something in the apache config file?

I could also note that when simply viewing the html files in my browser (outside of the localhost), the pages work fine and load regardless of their position in the directories. Thanks for any help!

Here is my modified conf file DocumentRoot section:

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

Answer Source

It turns out the issue was due to an unlucky coincidence preventing a subdirectory to be called, precisely, "examples"... See this page which discusses the issue and proposes a fix.

In short, you can:

  1. Either go to the file C:\xampp\apache\conf\extra\httpd-ajp.conf and add a "#" to comment out the conflicting line: ProxyPass /examples ajp:// smax=0 ttl=60 retry=5
  2. Or simply rename the "examples" directory differently (e.g. examples2)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download