将网站部署到 cd - 路径

发布于 2024-09-13 12:07:44 字数 192 浏览 6 评论 0原文

将静态 HTML 网站移植到 CDROM 的最佳方法是什么,允许用户插入磁盘,复制文件,然后“脱机”运行该网站。

我应该使用什么样的路径结构?目前所有资产都类似于:

file:///C:/Users/User/Desktop/MySite/index.html ,

这显然不是很便携,

感谢您提供任何信息

what's the best way of porting a static HTML website to a CDROM, to allow users to insert the disk, copy the files off, and then run the site "offline", as it were.

what sort of path structure should i use? at the moment all of the assets are like:

file:///C:/Users/User/Desktop/MySite/index.html

which obviously isn't very portable

thanks for any info

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悍妇囚夫 2024-09-20 12:07:44

您应该使用相对路径,例如
index.html

images/img.gif

如果您有许多绝对链接,请搜索“file:///C:/Users/User/Desktop/MySite/”并将所有内容替换为“”(或“./”,以使事情更清晰)。 Notepad++ 可以搜索一个目录下的所有文件。

为了让事情变得更清楚,在根目录中创建一个包含所有文件和更多子目录的子目录,以及可选的一个index.html,这样用户只需复制一个文件夹(加上一个index.html)。

You should use relative paths, like
index.html
and
images/img.gif.

If you have many absolute links, search for "file:///C:/Users/User/Desktop/MySite/" and replace all with "" (or "./", to make things clearer). Notepad++ can search across all files of one directory.

To make things even clearer, create a subdirectory with all files and more subdirs and optionally an index.html in the root directory, so the user only has to copy one folder (plus one index.html).

幸福丶如此 2024-09-20 12:07:44

您可以尝试使用便携式网络服务器应用程序。
该应用程序允许在任何驱动器(USB 闪存或 CDROM)上运行任何网站。主要优点是您不应该将链接从绝对路径更改为相对路径。此外,如果应用程序使用数据库或 PHP,则该应用程序将打开您的网站。

例如:XAMPP(便携式 Web 服务器)等。

You can try to use portable web-server application.
This application allow to run any websites on any drives (USB-Flash or CDROM). The main advantage that you shouldn't to change links from absolute paths to relative. Also, the application will open your sites if that uses a database or PHP.

For example: XAMPP (Portable Web Server) and many others.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文