Forum Moderators: phranque
I put this in .htaccess file:
AddType text/html .html
AddHandler server-parsed .html
Options Indexes FollowSymLinks Includes
I want to parse all html files for SSI's as long as all my files are .HTML and include SSI's.
Well, almost all... There's one file PHP, which makes all the trouble. When I put the code above, that PHP file doesn't process at all. When I add .php next to AddType and AddHandler, my PHP file shows the actual code instead of processing it.
Is there some simple workaraound? Maybe I use wrong commands?
thx.
Apache 1.3 [httpd.apache.org]
Apache 2.0 [httpd.apache.org]
I want to parse all html files for SSI's as long as all my files are .HTML and include SSI's.
Well, then I'd follow the first link and listen to the developers recommendation...
A brief comment about what not to do. You'll occasionally see people recommending that you just tell Apache to parse all .html files for SSI, so that you don't have to mess with .shtml file names. These folks have perhaps not heard about XBitHack. The thing to keep in mind is that, by doing this, you're requiring that Apache read through every single file that it sends out to clients, even if they don't contain any SSI directives. This can slow things down quite a bit, and is not a good idea.
Options Indexes FollowSymLinks IncludesRemember that this mapping is added to any already in force, overriding any mappings that already exist for the same extension. Make sure you test.
AddType text/html .html
AddHandler [httpd.apache.org] server-parsed .html .php
I just added this:
------------------------------
Options +Includes
AddType text/html .html
AddHandler server-parsed .html
------------------------------
Instead of this:
------------------------------
Options Indexes FollowSymLinks Includes
AddType text/html .html
AddHandler server-parsed .html
------------------------------
And everything worked just great.
All html files that have includes are
normally parsed and PHP script also processes
perfectly. No problems.
Can You explain me what has happened?
Normally, if multiple Options could apply to a directory, then the most specific one is taken complete; the options are not merged. However if all the options on the Options directive are preceded by a + or - symbol, the options are merged. Any options preceded by a + are added to the options currently in force, and any options preceded by a - are removed from the options currently in force.Resource:
Options [httpd.apache.org]
Another discussion on SSI and PHP that may be of interest [webmasterworld.com].
I see You're a pro in SSI and can answer almost any question. Last one I'd like to ask is this:
---------------------------------------------
"You'll occasionally see people recommending that you just tell Apache to parse all .html files for SSI, so that you don't have to mess with .shtml file names. These folks have perhaps not heard about XBitHack. The thing to keep in mind is that, by doing this, you're requiring that Apache read through every single file that it sends out to clients, even if they don't contain any SSI directives. This can slow things down quite a bit, and is not a good idea."
---------------------------------------------
But if ALL my files contain Includes, then there's no difference if I use XBitHack or simple parsing, right?
I would venture to guess that you are correct in that if you are running server-side includes on every page then it wouldn't matter if you are using the XBitHack or AddHandler (or AddOutputFilter, if on Apache2). But, as I said, that is a guess at best. To know for sure I guess you would have to perform some server tests or perhaps look into the development source code.