Render php in html page using htaccess

Recently i got a project where i had to convert all the existing static html pages into php and i had to use common header and footer in-order to make the editing of links easier. The site had good page ranking and all the pages indexed were .html format.

The following code helped me render php inside a html page.

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

Using the above htaccess file, you can write php codes between php tag and it will be rendered as php when the page runs.

Cheers. Do let me know your comments/feedback

3 Comments on "Render php in html page using htaccess"

    1. Hey Tasso, i was not aware of the other ways. When i finally found the solution, i thought of sharing it here. Please feel free to share your method too using mod_rewrite.


Leave a Reply

Your email address will not be published. Required fields are marked *