How to make an html page PHP?

30 replies
Hey everyone, I am using the conversion chicken to do my split testing, but it requires you to have the pages you want to split test as a PHP extension not htm or html.

Is there a way to take a page with the html extension and change it to PHP or do I need to start from scratch?

Thanks, I am very new to internet marketing and about the worst there is when it comes to techie stuff, so dont expect me to know anything!

Ashley
#html #make #page #php
  • Profile picture of the author Intrepreneur
    Originally Posted by AshleyAA View Post

    Hey everyone, I am using the conversion chicken to do my split testing, but it requires you to have the pages you want to split test as a PHP extension not htm or html.

    Is there a way to take a page with the html extension and change it to PHP or do I need to start from scratch?

    Thanks, I am very new to internet marketing and about the worst there is when it comes to techie stuff, so dont expect me to know anything!

    Ashley
    You can't exactly make an HTML page a php page, but you can use php code to call an HTML page to the broswer for display.
    {{ DiscussionBoard.errors[855489].message }}
    • Profile picture of the author Ashley Gable
      Originally Posted by Intrepreneur View Post

      You can't exactly make an HTML page a php page, but you can use php code to call an HTML page to the broswer for display.
      Cool, how do I do that? Is it hard?

      Thanks for the reply
      Ashley
      {{ DiscussionBoard.errors[855568].message }}
      • Profile picture of the author Intrepreneur
        Originally Posted by AshleyAA View Post

        Cool, how do I do that? Is it hard?

        Thanks for the reply
        Ashley
        I have absolutely no idea.

        It takes programming knowledge, but I'm sure that if you bought a script it should have shown you how to do this.
        {{ DiscussionBoard.errors[855609].message }}
  • Profile picture of the author AtomicFlipper
    just rename the page with the extension of php, change index.html to index.php, it will still work the same.

    The only difference will be the web server will pass the page to the PHP preprocessor before sending to the browser, being that there is no php code in the file, it will only add a few microseconds to the processing of the page.
    {{ DiscussionBoard.errors[855566].message }}
    • Profile picture of the author Jeremy Morgan
      Originally Posted by AtomicFlipper View Post

      just rename the page with the extension of php, change index.html to index.php, it will still work the same.

      The only difference will be the web server will pass the page to the PHP preprocessor before sending to the browser, being that there is no php code in the file, it will only add a few microseconds to the processing of the page.
      This is the most simple answer. Just rename index.html to index.php and you're good to go. In the future you can add php if you like also.
      Signature
      Jeremy Morgan, Software Developer / SEO
      Check out my Programming Blog for news, tips, and tutorials
      {{ DiscussionBoard.errors[951168].message }}
  • Profile picture of the author jessewrites
    Website creator yola.com creates its pages in php. It's pretty easy to use too. Might be an option for you.
    {{ DiscussionBoard.errors[855646].message }}
    • Profile picture of the author mixelplik
      Their or programs on the open market now that let you create a PHP version of your html site and keep both of them, great for split testing. Off the top of my head I can't think of the one I was just looking at, but give Big G a query with php converter and see what you get!

      Hope this helps!
      {{ DiscussionBoard.errors[856571].message }}
  • Profile picture of the author mhuktar
    Banned
    [DELETED]
    {{ DiscussionBoard.errors[856649].message }}
    • Profile picture of the author lharding
      Hi,

      If you just need to call a PHP file and you have a HTML file, simple rename the file, for example. index.html would become index.php. Your web server will treat the PHP file differently but as you won't have any actual PHP code in there, it will not produce any difference.

      To put PHP code into the file, you would have to "surround" the php code with <?PHP your PHP code would go here ?>

      Hope that helps.
      Lee.
      Signature
      Lee Harding
      The Architect
      {{ DiscussionBoard.errors[856825].message }}
      • Profile picture of the author Ashley Gable
        Originally Posted by mixelplik View Post

        Their or programs on the open market now that let you create a PHP version of your html site and keep both of them, great for split testing. Off the top of my head I can't think of the one I was just looking at, but give Big G a query with php converter and see what you get!

        Hope this helps!
        I will look into this, it sounds great.
        Originally Posted by lharding View Post

        Hi,

        If you just need to call a PHP file and you have a HTML file, simple rename the file, for example. index.html would become index.php. Your web server will treat the PHP file differently but as you won't have any actual PHP code in there, it will not produce any difference.

        Hope that helps.
        Lee.
        I contacted Tim (guy who developed conversion chicken) and asked him about this, if it will work this is the way I want to go! It is the easiest and a less chance I will screw something up.

        Thanks for all your help
        {{ DiscussionBoard.errors[857716].message }}
  • Profile picture of the author mywebwork
    Ashley, Lee is correct - all you need to do is simply rename your file with a "php" extension. So "index.html" can simply be renamed "index.php".

    It's as simple as that!

    Bill
    {{ DiscussionBoard.errors[859898].message }}
    • Profile picture of the author Ashley Gable
      Originally Posted by mywebwork View Post

      Ashley, Lee is correct - all you need to do is simply rename your file with a "php" extension. So "index.html" can simply be renamed "index.php".

      It's as simple as that!

      Bill

      YEP! I got an email back from Tim and he said that you all were correct. All I have to do is rename them with PHP on the end.

      Thanks for the help
      Ashley
      {{ DiscussionBoard.errors[861490].message }}
  • Profile picture of the author robdraw
    Also you can use .htaccess to run html and htm files with php code inside them, I do this with all my websites, makes it easier to load the same headers, navigation menus and footer, and then I just call them into my html file.

    For web servers using PHP as apache module add the following to your .htaccess :
    AddType application/x-httpd-php .html .htm

    Then they will run with the html extension and execute the php code
    {{ DiscussionBoard.errors[860344].message }}
    • Profile picture of the author Ken Shorey
      Originally Posted by robdraw View Post

      Also you can use .htaccess to run html and htm files with php code inside them, I do this with all my websites, makes it easier to load the same headers, navigation menus and footer, and then I just call them into my html file.

      For web servers using PHP as apache module add the following to your .htaccess :
      AddType application/x-httpd-php .html .htm

      Then they will run with the html extension and execute the php code
      This doesn't work on many servers since an update to php and apache a few months ago.
      I had to change several hundred pages over to php file names to use my includes. Took forever and then had to do redirects to all the new files.

      If you think there is the slightest posiblity that you will ever want to use php on your site, name your files with a php extension to begin with.
      {{ DiscussionBoard.errors[894441].message }}
      • Profile picture of the author rtrotter
        Originally Posted by Ken Shorey View Post

        This doesn't work on many servers since an update to php and apache a few months ago.
        I had to change several hundred pages over to php file names to use my includes. Took forever and then had to do redirects to all the new files.

        If you think there is the slightest posiblity that you will ever want to use php on your site, name your files with a php extension to begin with.
        What version of PHP and Apache are you referring to? I am using this approach on my dedicated server and servers in the Amazon EC2 cloud and have not seen any problems.

        Rodney
        Signature

        Ping All Your Feed On Auto-Pilot
        www.kping.com

        {{ DiscussionBoard.errors[895918].message }}
        • Profile picture of the author Ken Shorey
          Originally Posted by rtrotter View Post

          What version of PHP and Apache are you referring to? I am using this approach on my dedicated server and servers in the Amazon EC2 cloud and have not seen any problems.

          Rodney
          Apache 2.2.11 and PHP 5.2.9
          {{ DiscussionBoard.errors[903460].message }}
          • Profile picture of the author rtrotter
            Originally Posted by Ken Shorey View Post

            Apache 2.2.11 and PHP 5.2.9
            I have Apache 2.2.9 and PHP 5.2.6 and it works when done in the httpd.conf file. I have never done it in .htaccess. Since the difference in what you are using and what I am using are just minor version changes, I really do not think they would make something as commonly used as this obsolete.

            Also another point on changing file names from html to php is indexing issue. If any of the pages have been index and you want to retain ranking, DO NOT change the file name.

            Rodney
            Signature

            Ping All Your Feed On Auto-Pilot
            www.kping.com

            {{ DiscussionBoard.errors[932799].message }}
      • Profile picture of the author BurgerBoy
        Originally Posted by Ken Shorey View Post

        This doesn't work on many servers since an update to php and apache a few months ago.
        I had to change several hundred pages over to php file names to use my includes. Took forever and then had to do redirects to all the new files.

        If you think there is the slightest posiblity that you will ever want to use php on your site, name your files with a php extension to begin with.
        It still works running php in .htm and .html pages.

        I had the same problem you did and only had to change one thing in the .htaccess file.

        The original code was AddType application/x-httpd-php .html .htm

        All you have to do is add a 5 to that then it will work again like it did before the update to php 5.

        AddType application/x-httpd-php5 .html .htm
        Signature
        {{ DiscussionBoard.errors[975068].message }}
  • Profile picture of the author yaji
    Rename it, as simple as that.

    If you have tons of files and if you use unix/linux, put the commans like the following in each line of the shell script:

    mv index.html index.php
    and wola, all were automatically done...
    Signature

    Thanks, Yaji

    Hypnosis Weight Loss Fun Info about Hypnosis Weight Loss | Cheap Car Insurance
    Cat Dandruff All about Cat Dandruff. A Must-Read for Cat Lovers

    {{ DiscussionBoard.errors[870684].message }}
  • Profile picture of the author clubvikram
    Banned
    yes it is as simple as renaming files from *.html to *.php,as far as writing programming code is concerned it is mainly required if you need to generate the content dynamically or your website needs to talk to database , extract values and display on your website.
    {{ DiscussionBoard.errors[893764].message }}
  • Profile picture of the author zoobie
    it's easy just use the ftp program to rename the file..
    hopes that help
    {{ DiscussionBoard.errors[903522].message }}
  • Profile picture of the author moreishi
    you need to know more HTML + CSS + JavaScript before you can use PHP
    {{ DiscussionBoard.errors[917615].message }}
  • Profile picture of the author jeffsolochek
    Save Your money. Get Netbeans which is free and use their help system both as regular lessons and Video How To's
    Signature

    Jeff Solochek
    http://www.jeffreysolochek.com/blog
    http://www.networkcelebrity.com

    I also build blogs for companies and individuals

    {{ DiscussionBoard.errors[922718].message }}
  • Profile picture of the author Noor Hayanah
    Originally Posted by AshleyAA View Post

    Hey everyone, I am using the conversion chicken to do my split testing, but it requires you to have the pages you want to split test as a PHP extension not htm or html.

    Is there a way to take a page with the html extension and change it to PHP or do I need to start from scratch?

    Thanks, I am very new to internet marketing and about the worst there is when it comes to techie stuff, so dont expect me to know anything!

    Ashley
    There is actually software that can do that. It can convert any html to php documents instantly. You can find it at htmltophp.com.

    I hope it helps.
    {{ DiscussionBoard.errors[932771].message }}
  • Profile picture of the author takingaction
    This forum is outstanding, but this thread is a hilarious example of people over complicating things or not correctly reading the original question.

    As a few people mentioned, the simple and most correct answer is to rename the .html/.htm file with a .php extension.

    Additionally, this post within the thread is helpful:

    Also another point on changing file names from html to php is indexing issue. If any of the pages have been index and you want to retain ranking, DO NOT change the file name.
    Happy 4th all.
    {{ DiscussionBoard.errors[942294].message }}
  • Profile picture of the author rtrotter
    Actually takingaction, what you say is the most correct answer is only if the site is new and no pages in index or other sites linking to it.

    In general, the most correct answer is placing

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

    in the httpd.conf or vhost.conf file. This will cause pages with htm or html extensions to be processed as php. This results in no change in the URLs of the site. In this way any indexing will be maintained and any links to the site's pages will be valid.
    Signature

    Ping All Your Feed On Auto-Pilot
    www.kping.com

    {{ DiscussionBoard.errors[945669].message }}
    • Profile picture of the author takingaction
      Hmmm... makes sense rtrotter.

      Please note that I quoted someone as mentioning that you should not rename the pages if they are indexed and ranked.

      I unfortunately made the assumption that the person asking the question did not have page rank or many backlinks to the site in question. That's totally my bad.

      The best way to do it in that case is to ask your client if the pages are indexed and, if so, whether they are ranked. If so, then it's best not to mess with renaming (again, I added a quote about this in my post). This also goes with backlinks. If there are a decent amount of good backlinks to secondary pages (not the index page) and the client wants these to work with php, then yes, don't change the extensions of those pages.

      The main problem with your solution is that it only works some of the time. I've worked with hosting companies where this does not work. Sure, they may not be great hosting companies, but my clients choose them, not me. Therefore I have to do what works, and the php renaming works every time.

      More than meets the eye I suppose... thanks for the comment rtrotter.
      {{ DiscussionBoard.errors[948473].message }}
  • Profile picture of the author B.W
    Its fine to change the file extension, just remember to 301 redirect the old pages, to the new pages. Can be done in htaccess as well, so rtrotters suggestion might be the best anyway.
    {{ DiscussionBoard.errors[948584].message }}
  • Profile picture of the author zain654321
    To parse the php code in .html extenction , just add the following line of code in .htaccess file .

    AddType application/x-httpd-php .html .htm
    {{ DiscussionBoard.errors[960572].message }}
  • Profile picture of the author rtrotter
    Just to expand it a little, using

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

    does work nicely (if hosting company allows it) and it is not limited. On one of my sites I do

    AddType application/x-httpd-php .html .htm .js .css

    and then have fun making the page interesting and highly dynamic. Just have to be sure and send the correct headers to specify content type.

    Rodney
    Signature

    Ping All Your Feed On Auto-Pilot
    www.kping.com

    {{ DiscussionBoard.errors[972917].message }}
    • Profile picture of the author josephalford
      just rename the page with the extension of php, change index.html to index.php, it will still work the same.

      The only difference will be the web server will pass the page to the PHP preprocessor before sending to the browser, being that there is no php code in the file, it will only add a few microseconds to the processing of the page.
      {{ DiscussionBoard.errors[974552].message }}

Trending Topics