Please Login or Register

Knowledgebase

[How to] Parse .HTML as PHP

A lot of users who start off only developing sites with simple .html files and want to start using dynamic server side languages like PHP but find it is not parsed will need to either have to rename all their files to .php which not only does it waste time can adversly affect search engine rankings because it has to be reindex etc or to avoid all this hassel you can simply add a short snippet of code to your .htaccess file which tells the server to also parse .html (or any other extension) as PHP.

All you have to do is add the following snippet to your .htaccess file.

CODE:
AddHandler application/x-httpd-php5 .html
AddType application/x-httpd-php5 .html

The same can be applied to other extensions (e.g. .htm or .shtml) by simply adding the extension to this line.

Example of multiple extensions:

CODE:
AddHandler application/x-httpd-php5m .php .html .htm .shtml
AddType application/x-httpd-php5m .php .html .htm .shtml

 

Updated: 12/08/09 to reflect server changes to suPHP environment.






Was this answer helpful?
Add to Favourites Add to Favourites   Print this Article Print this Article
Also Read
Windows Hosting? (Views: 1375)
Low Server Uptime? (Views: 1399)

Powered by WHMCompleteSolution

Language:


Web Hosting
Client Login
Web Hosting

Email

Password

Remember Me


Web Hosting
Search
Web Hosting




Follow Us on Twitter