我有一個純HTML網站克隆到我的本地XAMPP服務器,它位於'foo'文件夾下。在這個文件夾中,只有.html文件和一個空的.htaccess文件。 當我打開URL localhost/foo時,瀏覽器將打開localhost/foo/index.html文件。所以問題是,服務器如何知道打開index.html文件?網絡服務器如何識別登錄頁面?
0
A
回答
1
如果選中了Apache的conf文件爲您的XAMPP安裝(C:\ XAMPP的\ apache的\的conf \ httpd.conf文件),你會發現下,以下聲明的DirectoryIndex:
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
index.html最終成爲apache將嘗試加載的第6個文件。您可以自定義此列表,在XAMPP控制面板中重新啓動Apache,並具有不同的默認文件加載。
0
這由Apache配置DirectoryIndex
決定。例如:
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.php index.html index.html.var
0
服務器將打開index.html(或index.htm或index.php文件)時,明確要求沒有其他的頁面,因爲這是在網站上的每個目錄的默認頁面。如果您要求提供zyx.com \ reports.html,那麼您將打開reports.html頁面,因爲您指定了要查看的頁面。如果您沒有要求提供特定頁面(即您在地址欄中輸入zyx.com),那麼該目錄的默認頁面就是索引頁面,所以這就是打開的頁面。如果您鍵入zyx.com並且沒有爲該目錄創建索引頁會發生什麼情況?服務器將返回該目錄中所有文件的列表,顯示所有文檔和/或圖像的鏈接。還會有一個指向父目錄的鏈接,因此在實踐中,查看者將能夠訪問您的文件以查找感興趣的內容。
0
Mostly servers support index.html as default file. But if you have any other file which you want to make it as landing page. You may change you htaccess
DirectoryIndex filename.extension
You can add multiple files there like following example. In this case anyone of theme present will be landing page. If all present then first will be given priority.
DirectoryIndex filename.extension filename.extension filename.extension
相關問題
- 1. 登錄頁面失敗 - 網絡服務器應力工具
- 2. windows server 2008:如何識別誰登錄到服務器
- 3. Javascript無法識別網絡服務
- 4. 語音識別(網絡)服務?
- 5. 單點登錄服務器/頁面
- 6. 任何網絡服務器可以識別私人IP地址
- 7. 登錄密碼網絡服務Java
- 8. 如何識別異常端口上的已知網絡服務?
- 9. 氣流:錯誤:無法識別的參數:網絡服務器
- 10. ASP.NET網絡服務和頁面方法
- 11. ASP.NET頁面方法vs網絡服務
- 12. 頁面方法vs網絡服務
- 13. 服務工作者登錄頁面
- 14. 自動登錄並上傳文件到網絡服務器
- 15. Android的Facebook登錄和網絡服務器
- 16. 登錄後更改網絡服務器用戶
- 17. 僅從網絡登錄網頁
- 18. DHCP服務器重定向任何網址登陸頁面
- 19. 網絡服務器和應用服務器有什麼區別
- 20. 如何在客戶端登錄時在服務器上的網絡服務帳戶中觸發服務?
- 21. 如何登錄/註冊從iPhone的一個應用一個網絡服務器
- 22. 主頁網絡/文件服務器
- 23. 如何使用python登錄到網站(wifi登錄頁面)?
- 24. 如何從'n'個服務器中識別MongoDB主服務器
- 25. 網絡如何識別設備?
- 26. NowJs服務器到網絡服務器
- 27. 如何設置Apache網絡服務器
- 28. 如何連接網絡服務器
- 29. 如何在G-WAN網絡服務器