[英]Server side include no longer seems to be working - “[an error occurred while processing this directive]”
[英]SSI Error with <!#--include virtual=“file.html” --> [an error occurred when processing this directive]
因此,我正在學習正確使用SSI,並已在一個站點上成功完成了此操作。 在新站點上,我在同一台服務器上構建時,在嘗試使用標簽時收到錯誤消息(處理此指令時發生錯誤),我已通過使用SSI來顯示時間和日期來驗證是否已啟用SSI,而沒有問題。 我還驗證了拼寫,並且目錄和文件在服務器上。 不知道出了什么問題,能否部分啟用SSI(允許我顯示時間,但不允許包含虛擬)? 我是否缺少明顯的東西? 多謝你們!
碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!--#include virtual="/ssi/navbar.html" -->
<h1>Hello, world!</h1>
<!--#echo var="DATE_LOCAL" -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
您的SSI標簽包括/ssi/navbar.html
。 由於以/
開頭,因此將其解析為基於服務器文檔根目錄的完整路徑。
http://christianstest.info/ssi/navbar.html
但是,這是404 Not Found
。 我認為您正在嘗試包括以下內容:
http://christianstest.info/TestingServers/ComeRestTest/ssi/navbar.html
您可能只需要刪除SSI標記中的前導/
。 virtual
指定相對於當前頁面的URL路徑,但是您將其指向服務器的根目錄。
<!--#include virtual="ssi/navbar.html" -->
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.