I wanted to avoid the redundant header/footer/etc. structures in my pages since I was editing them manually. So, I setup my site to parse the HTML files as PHP files, and then used PHP includes:
<?php include 'head.php' ?>to build the pages on the fly. This allows me to maintain each page using simple HTML and avoid duplication of boilerplate HTML. This works because I added the following line to the .htaccess file:
AddHandler x-httpd-php .html .htmThis solutions works well, but unfortunately destroys GoDaddy's web statistics (/stats/) output. Apache attempts to parse these html files as well, but because of how they setup permissions (you have none), it fails and results in an HTTP 500 error.
This would be a simple fix if I could edit the .htaccess file in the stats directory. I could simply override the .html handler back to the default, and avoid the PHP processing.
Instead, it looks like my options are:
- FTP the files to my local machine and view them there.
- Create a script that copies them to a different directory (with the correct permissions and .htaccess override) and view them there.
- Change my files to .htm or another extension that doesn't conflict with the /stats files (.html).
- Get Creative.
My hack was simply to create a PHP file that reads the files out of the /stats directory. Here is a crude version:
<?phpYou could expand this to be dynamically driven from a request parameter. Again, this is a HACK, but for the specific purpose it works. It should of course be secured if you want to maintain the security defined in the original /stats directory.