The correct way is to use the server side. A PHP solution requires that PHP be installed only to include files, html solutions are not supported by the specification, even if they work (the specification does not distinguish between mime types, but it indicates its intention, which means that it can be explicitly prevented in the future, if these tags are not just completely out of date).
Here is my post from a similar topic asking about the same:
If your server supports SSI (server side), you can put the following into your html files without requiring a scripting language or anything else. Apache has SSI enabled by default (I think?)
“file” refers to the current file and probably what you will use to include related files, such as “actual_article_poll.html”.
"virtual" refers to the root of the document (i.e. to the root of your site), and you will use it to include global files such as headers and footers.
It does not matter which one you choose, but it is useful to know the difference between them.
In addition, the include directive makes a new internal HTTP request for the server for each file, so you can include php files and the like, and they will be executed as they should.
Here's a useful overview of SSI: http://en.wikipedia.org/wiki/Server_Side_Includes
Tor Valamo Dec 25 '14 at 20:00 2014-12-25 20:00
source share