|
||
Server Side Include |
||
[chongo's home] [Astronomy] [Mathematics] [Prime Numbers] [Programming] [Technology] [contacting Landon] |
<Directory "../ssi">
...
Options IncludesNoExec ...
...
</Directory">
NOTE: We used the IncludesNoExec directive instead of Includes. By using IncludesNoExec (and not Includes) we disable execution of commands such:<pre;>For the sake of security, the above HTML will cause the Apache server to execute some_program because we use the IncludesNoExec directive instead of Includes in our Apache server configuration.
<!--#exec cmd="some_program" -->
</pre>
By default, the Apache server will perform SSI only on files that end with the .shtml file extension. This web page is SSI processed because the filename is index.shtml and not just index.html.
Refer to the Apache Tutorial: Introduction to Server Side Includes for deailed informaton about configuring Apache for SSI.
For example, we can include the contents of our robots.txt file by adding the following SSI directive into our HTML file:
<!--#include virtual="/robots.txt" -->
Our robots.txt file is located at the top of our document root, so we used the path /robots.txt.
Here we insert the contents of the /robots.txt file in the middle of this web page by using the above mentioned SSI directive:
-- before the #include directive --
-- after the #include directive --
Of course, the above include was formatted by the browser. If you wanted to include the file without formatting, then use:
<pre><!--#include virtual="/robots.txt" --></pre>
Example:
© 1994-2013
Landon Curt Noll chongo (was here) /\oo/\ $Revision: 8.1 $ $Date: 2022/07/07 23:48:26 $ |