将文件夹索引更改为文件夹内的 HTML 页面
我看过一些带有 链接到文件夹
的示例,但我真的不明白它是什么或如何操纵它或将其获取到设置文件夹内的特定 html 页面。 我的网站是一个基本网站,只有 CSS 和 HTML 它的格式是
[file]home.html // C:/Users/user/Desktop/mywebsite/home.html
[folder]Order // C:/Users/user/Desktop/mywebsite/order/
↳[file]ordersheet.html // C:/Users/user/Desktop/mywebsite/order/ordersheet.html
我想尝试将文件夹路径 C:/Users/user/Desktop/mywebsite/order/
设置为文件 ordersheet.html C:/Users/user/Desktop/ mywebsite/order/ordersheet.html
如何做到这一点?
I have seen a few examples with <a href=".">link to folder</a>
but i realy don't understant what it is or how to manipulate it or get it to set the specific html page within the folder.
My website is a basic one with only CSS and HTML
it is formatted as
[file]home.html // C:/Users/user/Desktop/mywebsite/home.html
[folder]Order // C:/Users/user/Desktop/mywebsite/order/
↳[file]ordersheet.html // C:/Users/user/Desktop/mywebsite/order/ordersheet.html
I want to try set the folder path C:/Users/user/Desktop/mywebsite/order/
as the file ordersheet.html C:/Users/user/Desktop/mywebsite/order/ordersheet.html
how can this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要将
/order
设置为ordersheet.html
,请将ordersheet.html
的名称更改为index.html
>index.html 是访问者访问该特定目录时服务器将向其提供的默认文件。
链接文本
= 您希望它向用户传达的内容/Users/user/Desktop/mywebsite/order/
= 目录路径请记住,这仅在本地有效。如果您将其放在服务器上,访问者将无法访问您的完整
C:/
驱动器,因此您必须使用相对链接,即/order/
To set
/order
toordersheet.html
change the name ofordersheet.html
toindex.html
The
index.html
is the default file that the server will serve to the visitor when he visits that specific directory.link text
= what you want it to say to the user/Users/user/Desktop/mywebsite/order/
= directory pathKeep in mind that this will only work locally. If you have it up on a server, visitors don't have access to your full
C:/
drive so you have to use relative links, i.e. just/order/
如果我没记错的话,你可以使用这样的东西:
如果你想将该锚定到文件夹,你只需使用这个:
If I remebember correctly, you use something like this:
If you would want to have that anchor to a folder, you would just use this:
您的浏览器直接在系统的本地文件系统上运行,因此您不能这样做。
您所看到的是网络服务器的功能(我将使用Apache HTTPD< /a> 示例)。
Web 服务器的典型配置会将 URI 的本地部分映射到本地文件系统上的目录,并且如果文件与 URI 的本地部分匹配,则仅在其中提供文件。
如果本地部分解析为目录(而不是文件),那么它将在该目录中查找名称与 列表(通常包括index.html)并提供该文件。
如果列表中的文件都不存在,那么它将 生成一个包含链接的 HTML 文档目录中的所有文件。
由于浏览器直接读取本地文件系统时不涉及 Web 服务器,因此无法将目录映射到索引文件,因此您需要在 URI 中显式包含文件名(或切换到使用 Web 服务器)服务器)。
Your browser is operating directly on your system's local filesystem, so you can't.
What you have been looking at is a function of a web server (I'll use Apache HTTPD for examples here).
A typical configuration of a web server would map the local part of the URI onto a directory on the local file system and just serve up the files there if they matched the local part of the URI.
If the local part resolves to a directory (rather than a file) then it would look for a file in that directory with a name that matched a list (typically including index.html) and serve up that file.
If none of the files on the list existed, then it would generate an HTML document containing links to all the files in the directory.
Since there is no web server involved when the browser is reading the local file system directly, there is no way to map the directory onto an index file, so you would need to explicitly include the filename in the URI (or switch to using a web server).