Forum Moderators: phranque
I have been reading the instructions at
[httpd.apache.org ],
but I can't get my include file to load into the test page. I tried with the .shtml file-extension on the test page as well as .html, but have had no joy - the page loads, but the include bit is missing.
In the config file I have checked that the following are in place:
LoadModule include_module modules/mod_include.so
#
#
<Directory "C:/sites/www/Mywebsite">
Options Indexes FollowSymLinks #this line was already there
Options Includes #I added this (and also tried just adding 'Includes' to the line above - didn't seem to make any difference)
AddType text/html .shtml #I added this
AddOutputFilter INCLUDES .shtml #I added this
</Directive>
In the test.html file I've added this line where the include needs to load, and changed it to test.shtml:
<!--#include virtual="/topnav.html" -->
I'm clearly doing something wrong, but I'm still new to Apache and server-speak, and I'm really stuck. Can anyone help please?
Many thanks!
When you're looking at your HTML source send to your browser, do you see the include command as-is or something else (error message)? Did you restart apache after you made the changes?
I'd like to keep the .html extension for all the pages that will have the includes, but the Apache tutorial warns against parsing all html files - yet I feel too out of my depth to use the XBitHack method described(the reference to the executable bit threw me!).
As I'm just adding includes which display flat html, should it be ok to parse all html files in this instance?
As I'm just adding includes which display flat html, should it be ok to parse all html files in this instance?
You could use a more fine tuned setup, i.e. add AddOutputFilter only for certain filenames (e.g. starting with a) or RemoveOutputfilter for certain filenames. See the <files> and <filesmatch> sections.