gpt4 book ai didi

include - SSI 包括虚拟相对路径不起作用

转载 作者:行者123 更新时间:2023-12-02 21:30:16 25 4
gpt4 key购买 nike

我的网站已设置为使用 SSI,并且运行良好。

但是,当我尝试通过 SSI 包含文件时,它不会工作,因为我使用相对路径。例如下面的作品

<html>
<head>
<!--#include virtual="include/head.shtml" -->
</head>
</html>

但事实并非如此(假设文件存在)

<html>
<head>
<!--#include virtual="../include/head.shtml" -->
</head>
</html>

我是否遗漏了什么,或者有什么方法可以获取有关此错误的更多信息。

最佳答案

根据Apache Tutorial :

The include element can determine what file to include with either the file attribute, or the virtual attribute. The file attribute is a file path, relative to the current directory. That means that it cannot be an absolute file path (starting with /), nor can it contain ../ as part of that path. The virtual attribute is probably more useful, and should specify a URL relative to the document being served. It can start with a /, but must be on the same server as the file being served.

根据Wikipedia :

"virtual" specifies the target relative to the domain root, while "file" specifies the path relative to the directory of the current file.

关于include - SSI 包括虚拟相对路径不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33491712/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com