這很可能是初學者的問題,但我似乎無法在任何地方找到修復程序,我發現處理它的幾篇文章未得到答覆(例如xampp in window 7 cannot access files in subfolder inside C:/xampp/htdocs)。XAMPP:在根目錄的子目錄中訪問html頁面
到目前爲止,我有一個使用XAMPP的工作本地主機(必須將端口更改爲8080),位於自定義文檔根目錄中。我可以加載index.html的,但是當我點擊一個鏈接向subdirectoy:
<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>
你做任何在conf文件中修改documentRoot? –
是的,我確實更改了DocumentRoot目錄(請參閱原始文章中的編輯)。這能解釋這個問題嗎?因爲據我所知,即使在新的根目錄中,本地主機也可以訪問index.html,而不是在子目錄中。 – sc28