首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >the服务器如何识别登陆页面?

the服务器如何识别登陆页面?
EN

Stack Overflow用户
提问于 2014-10-16 19:49:31
回答 4查看 457关注 0票数 0

我有一个纯HTML网站克隆到我的本地XAMPP服务器,它是在'foo‘文件夹下。在此文件夹中,只有.html文件和空.htaccess文件。当我打开URL localhost/foo时,浏览器将打开localhost/foo/index.html文件。那么问题是,服务器如何知道它是打开index.html文件的呢?

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2014-10-16 19:56:45

如果您检查XAMPP安装(C:\xampp\apache\conf\httpd.conf)的apache文件,您将在DirectoryIndex下找到以下声明

代码语言:javascript
运行
复制
<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,并加载不同的默认文件。

票数 1
EN

Stack Overflow用户

发布于 2014-10-16 19:56:50

这是由Apache配置DirectoryIndex确定的。示例:

代码语言:javascript
运行
复制
# 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
EN

Stack Overflow用户

发布于 2014-10-16 20:03:25

当没有显式请求其他页面时,服务器将打开index.html (或index.htm或index.php),因为这是网站上每个目录的默认页面。如果您请求zyx.com\reports.html,那么您将打开reports.html页面,因为您指定了要查看的页面。当您不要求一个特定的页面(即在地址栏中输入zyx.com )时,该目录的默认页面就是索引页,因此打开的就是索引页。如果键入zyx.com而没有为该目录创建索引页,会发生什么情况?服务器将返回该目录中所有文件的列表,显示指向所有文档和/或图像的链接。还有一个指向父目录的链接,因此在实践中,查看器可以访问您的文件来查找感兴趣的内容。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26412692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档