How come my HTML Include wont work?

2019-07-16 14:38发布

I am making a site right now and I want to include the sidebar in every page. I have looked everywhere and everyone says to use the following code:

<!--#include virtual="insertthisfile.html" --> 

I have done this but to no avail. I am using dreamweaver for easier uploading and managing of my files, and it shows up in dreamweaver. I would just use PHP but I dont want all of my pages to be PHP for just one code that can work in HTML..

Any ideas?

标签: html include
3条回答
虎瘦雄心在
2楼-- · 2019-07-16 15:21

That isn't an "HTML" feature. It's Server-Side Includes. You need to make sure you have SSI active on your server and that it's set to apply to the file.

查看更多
劫难
3楼-- · 2019-07-16 15:23

This page has a lot of info on Server and Client side includes. It shows a couple of alternatives to the #include also.

Start by trying to rename the .html file to .shtml. Also, make sure server side includes are enabled on your server.

查看更多
beautiful°
4楼-- · 2019-07-16 15:29
  • Make sure the (including) file has a .shtml extension
  • Make sure server-side includes are enabled in the web server
查看更多
登录 后发表回答