XAMPP Run SSI (Server Side Include) with PHP 5

I have a very stupid website.

This website is developed by someone who use PHP 5.4 (FastCGI), Apache 2.4.9, MySQL 5.1.

The most important thing is, this person is using SSI (Server Side Include) with PHP....

Which means, when page load, visitor will be redirected from index.php to somedir/start.html.

And in the .html file, this person is using SSI.

The start.html will look something like this:

<td width="650" rowspan="2" align="left" valign="top" style="padding-top:16px;">
<a href="3dcreative.html" target="_blank">
                    <img src="common/homepage/201408/3dcake.jpg" border="0" width="390" height="200" style="padding-right:10px; float:left"/></a>
                <!--#include virtual="main_cake_series.php"-->
<!--#include virtual="main_ssi_banner.html"-->
</td>

Don't ask me why this person is doing such stupid thing under PHP, where it can simply be solved by using "include" or "require", all I know is, it is stupid.

I did a lot of research about enable SSI with PHP, and here is what I found:

In your .htaccess file, do this:

######################################
DirectoryIndex index.php   #Change to whatever you like

# Below 3 lines are what make SSI and PHP works
AddHandler application/x-httpd-php .php
AddType text/html .html
AddOutputFilter INCLUDES .html
######################################

Hope it saved you 2 - 3 hours (Which I did) from research.

Comments

Popular posts from this blog

TCPDF How to show/display Chinese Character?

Wordpress Load balancing: 2 web servers 1 MySQL without any Cloud services

Using wget bypass htaccess username password 401 authorization