Parse shtml as SSI, but also include PHP using .ht

2019-09-02 15:59发布

问题:

I have a particular situation with code i'm inheriting which is using shtml server-side-include, however I'm attempting to add some very simple login functionality to the site so I need to include a session check in PHP.

However my the only configuration I can do to the server is the .htaccess file.

I can get the server to parse the shtml as PHP using htaccess, OR use SSI however I cannot get it to parse it as both.

回答1:

This .htaccess configuration worked, allowing the server to use more than one handler to parse the file. As expected.

AddHandler application/x-httpd-php .shtml
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml


标签: php ssi shtml