How to change a html website to php?

Discussion in 'PHP' started by fracekm, Nov 9, 2009.

  1. #1
    My current website index file is in html and I would like to add something called tracewatch to keep track of my web stats. The only problem is that it says in order for it to work "Make sure the file is processed by the server as php (if the file extension is .html or .htm change it to .php)"

    How can I make to to where my index file is php and I can use this?
     
    fracekm, Nov 9, 2009 IP
  2. tvshock

    tvshock Peon

    Messages:
    102
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    its easy just save your page from .html to .php. it will work without any php code inside them.
     
    tvshock, Nov 9, 2009 IP
  3. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #3
    There are two ways:
    1. Put the following lines in .htaccess
    
    AddType application/x-httpd-php .php .htm .html
    AddHandler x-httpd-php .php .htm .html
    
    Code (markup):
    so your html page will be processed as php.

    2nd.
    Add this line:
    
    DirectoryIndex index.php
    
    Code (markup):
    Rename your index.html to index.php and put your php code there.
     
    AsHinE, Nov 9, 2009 IP
  4. fracekm

    fracekm Active Member

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    worked perfect! thank you!
     
    fracekm, Nov 9, 2009 IP