2種方法開啟apache中ssi,使得apache支持ssi
在httpd.conf中修改
1:
找到#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
去掉前面的#
2,在網(wǎng)站根目錄下加入以下代碼,即可開通ssi
在根目錄(虛禮目錄)中加---
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Includes FollowSymLinks MultiViews
# ~~~~~~~~ <= INCLUDES 啟動shtml腳本中用
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
(新浪發(fā)布新聞差不多的)例子:站點根目錄為(虛禮目錄):F盤
在f盤下面建立公用調(diào)用數(shù)據(jù)庫文件,header.php
header.php:
echo "這里是header部分輸出的文字";
?>
由后臺生成靜態(tài)頁面: F:/html/2008/11/5/173710234.shtml
另外在f:/下建立,x.shtml
x.shtml:
瀏覽可以得出:這里是header部分輸出的文字
上方就是一個簡單的ssi技術(shù)實例
173710234.shtml:
瀏覽出錯,因為file命令只能調(diào)用相對根目錄下的文件,簡單的說能往下包含,不能往上包含。
173710234.shtml:
瀏覽可以得出:這里是header部分輸出的文字
比較得到,file和virtual的不同。
file 指定包含文件相對于本文檔的位置
virtual 指定相對于服務(wù)器文檔根目錄的位置
通過以上2中方法既可讓apache開啟ssi功能
掃一掃
關(guān)注新圖聞科技
全國咨詢熱線
186-0984-0880