我有一个纯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网络服务器