Hi, I'm new to this and have (for me, at least) a bit of a strange problem. I've set up SSI on my home apache2 server, adding some lines to /etc/apache2/apache2.conf (on Debian). The strange thing its working fine if I go to http://myip/index.html or http://myip/stuff.html, but when I go to just http://myip/ it doesn't include the text (the include command shows as a comment on the page source). I thought a request to http://myip/ just pulled the index.html file so am unsure what's going on... Might it have something to do with declaring the 'AddOutputFilter INCLUDES .html; AddType text/html .html;...' within a <Directory /var/www/*> tag in the conf file? Any help greatly appreciated Phil
Just so you know what's happening, here's the site: http://86.7.112.192/ which doesn't parse the includes, and http://86.7.112.192/index.html which does.
My guess is that since the URI doesn't include the .html extension, AddOutputFilter doesn't get triggered for the request. What happens if you replace addoutputfilter with addoutputfilterbytype? XBitHack seems to parse SSI directives when a directory is requested instead of the filename.
Hi, thanks for getting back to me. addoutputfilterbytype doesn't produce any different results, and declaring 'XBitHack on' and commenting out the handlers etc (and then $ chmod +x index.html) doesn't produce different behaviour either. I'm out of ideas for this now...
What's the actual config you have? I know you wrote it above, but I am guessing it's not exactly like that in your Apache config. Maybe something a bit wrong in it (even the order). Also, do you definitely not have index.htm or index.shtml (or similar) as well?
Thanks for getting back. I definitely don't have other file types (only have 5 files in the www folder!). I can post the config when I get home. Strange how it would effect one url format but not the others though, seems like joebert might be onto something. Posted the q on serverfault.com got this response: My guess: the first format 86.7.112.192 becomes GET /, it does not contain .html ending, thus it's not parsed for SSI.
That shouldn't happen (although I admit it's quite a few years ago that I used SSI), your DirectoryIndex is still .html. It seems more like an Apache configuration problem. Have you checked the server logs?
Interesting. I've got Apache setup to use XBitHack on an index.html, and in my case it's parsing the SSI whether I access index.html or just / Maybe a silly question, but you did remember to reload/restart Apache after updating your conf right?
Yep, I've been restarting (no such thing as a silly question with something like this!). I've put links to the the conf file and the access log here: http://86.7.112.192/stuff.html. One thing i noticed on the access log, is that when i make a request to / it doesn't show up on there (?). I also tried a simple rewrite rule of the form RewriteRule http://86.7.112.192/ http://86.7.112.192/index.html which didn't work (it did do a rewrite and reroute when i appended stuff.html to the first argument, so mod_rewrite is working). Thanks for your help on this, am learning a lot because of this problem . I haven't touched anything in the conf file apart from changing loglevel to debug and adding the #ssi section at the end, so have no idea why yours, joebert, is running fine and mine isn't, very strange
It's kind of interesting that there's different headers being sent with the different URLs. http://86.7.112.192/ HTTP/1.1 200 OK Date:Wed, 06 Feb 2013 00:08:26 GMT Server:Apache/2.2.22 (Debian) Last-Modified:Tue, 05 Feb 2013 10:05:29 GMT ETag:"202e8-10c-4d4f7596a6c40" Accept-Ranges:bytes Content-Length:268 Vary:Accept-Encoding Connection:close Content-Type: text/html Code (markup): http://86.7.112.192/index.html HTTP/1.1 200 OK Date:Wed, 06 Feb 2013 00:08:27 GMT Server:Apache/2.2.22 (Debian) Accept-Ranges:bytes Vary:Accept-Encoding Connection:close Content-Type: text/html Code (markup): It's as if the server is returning a different page altogether.
1. What do the logs (error, not access) show for a request with and without index.html? 2. What additions did you make to .htaccess?
error.log has nothing for either / or /index.html, and I don't have an .htaccess file, have just added the section in apache2.conf. When i try to use a .htaccess (by shifting the directives from apache2.conf that i added) it doesn't work, which is also weird. Am thinking it might be less hassle to do a fresh install at this point?!
Instead of: <!--#include file="shared.txt" --> Code (markup): Try: <!--#include virtual="/shared.txt" --> Code (markup): (Or /path/to/shared.txt instead.)
Thanks for the suggestion, but that doesn't make a difference either (I get an error shown on the pages when using the full path, but virtual = "/shared.txt" gives the same result. Thanks for your help here, but I think I'm going to start again, I might have done something silly early on, who knows... Again, thanks a ton for the help, has taught me a lot. Cheers. P
Have you tried going the "traditional" route and tested this naming the html files (and included file) as .shtml? It will mean some additional settings, but these are documented on the Apache help pages: http://httpd.apache.org/docs/current/mod/mod_include.html Establish whether this works, or not. It will help narrow down the problem. Oops, of course the literal path for virtual wouldn't have worked as it would have tried to use it as an URL.