Enable PHP on HTM or HTML Pages



Save this to Del.icio.us

Enable PHP on HTM or HTML Pages

There may come a time when you want to use PHP on your static .HTM or .HTML pages. This may be due to the fact that you do not want to change the file extensions from .HTM to .PHP etc... as this will have a negative impact on your webpages in the short to medium term.

On some servers it is possible to use PHP on .HTM or .HTML pages simply by using the standard <? and ?> tags with the PHP code placed inbetween. However this is not the case with all servers and this tutorial is to guide you through setting up your server so that it can run PHP on .HTM / .HTML pages.

What we need to do is to tell the server to enable PHP on .HTM and .HTML pages. This can be done using a file called ".htaccess". If you are unfamiliar with this file it may be worth researching into it as it can prove very useful.

To enable PHP on your static .HTM and .HTML pages, firstly create a file called ".htaccess". Then place the following code (below) into this file and save it with the unicode format.

AddHandler application/x-httpd-php .htm .html

Now upload this file onto your server in the root directory and you should now be able to run PHP on your static pages.

[ Back to Website Optimization ]

Forums | Search | Donate | Links | Contact | Templates | Privacy Policy
Copyright © 2017 SiteToolCenter.com

Website Design

Best Viewed With Mozilla FireFox