Sometime in web applications, you may feel inclined to have dynamic code in .css, .js, .htm or .html files. To get Apache to parse these types of files you can create an .htaccess file and use the ”AddHandler application/x-httpd-php” command followed by the extensions you would like to have parsed as php. Depending on your Apache configuration, you may have to use ”AddHandler application/x-httpd-php4” or ”AddHandler application/x-httpd-php5” for different versions.
This can be used to parse .html as such:
AddHandler application/x-httpd-php .htm .html
You can also parse .asp files as .php (this of course will only allow you to give the illusion of running ASP… if you really want to use .asp with apache, use mod_mono) :
AddHandler application/x-httpd-php .asp
Another cool trick is to parse custom file extensions to give a unique feel to your website. For example, if I felt like doing a highly supervised search-and-replace on Joomla!, I could replace all of the PHP files on The Clever Geek with .tcg files and run them like so:
AddHandler application/x-httpd-php .tcg
| Comments |
|
!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."
| < Prev |
|---|












