How to force apache to parse html files as php?
Below are some reasons why people like to parse HTML file as PHP.
- Search engines seem to more favor web pages that have .html extension instead of dynamic .php extensions.
- Converting an old static website into a dynamic website and worry about losing page ranks.
- Security reasons…You don’t want visitors to know what scripting language you using.
AddType application/x-httpd-php .html .htm
or,if the AddType directive does not work, you can use the AddHandler directive as follows
AddHandler application/x-httpd-php .html .htm or
AddHandler x-httpd-php .html .htm
Some webhosts, require both directives, as below
AddType application/x-httpd-php .htm .html
AddHandler x-httpd-php .htm .html
You can also try this multi-line approach which uses the SetHandler directive
Websites using this approach are slower than websites that simply use PHP extension files; So It is a great solution only for small website 🙂