Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 06-07-2009, 02:37 PM   #1
Advanced Warrior
War Room Member
 
Ashley Gable's Avatar
 
Join Date: Jan 2009
Location: USA
Posts: 804
Thanks: 168
Thanked 87 Times in 78 Posts
Default How to make an html page PHP?

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
Ashley Gable is offline   Reply With Quote
Old 06-07-2009, 05:25 PM   #2
I.C.Hope
War Room Member
 
Intrepreneur's Avatar
 
Join Date: Apr 2009
Location: Northern Ireland
Posts: 2,515
Thanks: 446
Thanked 227 Times in 181 Posts
Contact Info
Send a message via Skype™ to Intrepreneur
Default Re: How to make an html page PHP?

Quote:
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.

I want a good keyword researcher, not for min sites but for tech articles. Hit me up if you've got those skillz!
Intrepreneur is offline   Reply With Quote
Old 06-07-2009, 05:57 PM   #3
Site Flipper
War Room Member
 
AtomicFlipper's Avatar
 
Join Date: Apr 2009
Location: Australia
Posts: 72
Thanks: 4
Thanked 3 Times in 3 Posts
Social Networking View Member's YouTube Profile
Contact Info
Send a message via Skype™ to AtomicFlipper
Default Re: How to make an html page PHP?

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.

AtomicFlipper is offline   Reply With Quote
Old 06-07-2009, 05:57 PM   #4
Advanced Warrior
War Room Member
 
Ashley Gable's Avatar
 
Join Date: Jan 2009
Location: USA
Posts: 804
Thanks: 168
Thanked 87 Times in 78 Posts
Default Re: How to make an html page PHP?

Quote:
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
Ashley Gable is offline   Reply With Quote
Old 06-07-2009, 06:17 PM   #5
I.C.Hope
War Room Member
 
Intrepreneur's Avatar
 
Join Date: Apr 2009
Location: Northern Ireland
Posts: 2,515
Thanks: 446
Thanked 227 Times in 181 Posts
Contact Info
Send a message via Skype™ to Intrepreneur
Default Re: How to make an html page PHP?

Quote:
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.

I want a good keyword researcher, not for min sites but for tech articles. Hit me up if you've got those skillz!
Intrepreneur is offline   Reply With Quote
Old 06-07-2009, 06:31 PM   #6
SEO Content Writer
War Room Member
 
jessewrites's Avatar
 
Join Date: May 2009
Location: Lafayette, LA
Posts: 58
Thanks: 5
Thanked 3 Times in 3 Posts
Default Re: How to make an html page PHP?

Website creator yola.com creates its pages in php. It's pretty easy to use too. Might be an option for you.

Need an SEO Content Writer? "Worth triple what I paid..." "On-time, reliable, and quality writer..." "A lot better than most other providers I have used..." Visit http://www.jessewrites.com or email me at writer@jessewrites.com for samples or to discuss your needs.
jessewrites is offline   Reply With Quote
Old 06-08-2009, 01:32 AM   #7
Warrior Member
 
Join Date: Aug 2007
Location: Fresno , USA.
Posts: 22
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to make an html page PHP?

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!
mixelplik is offline   Reply With Quote
Old 06-08-2009, 04:05 AM   #8
The Architect
War Room Member
 
lharding's Avatar
 
Join Date: Jun 2009
Location: Cambridgeshire, UK
Posts: 113
Thanks: 18
Thanked 17 Times in 17 Posts
Contact Info
Send a message via Skype™ to lharding
Default Re: How to make an html page PHP?

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.

Lee Harding
The Architect
lharding is offline   Reply With Quote
Old 06-08-2009, 10:52 AM   #9
Advanced Warrior
War Room Member
 
Ashley Gable's Avatar
 
Join Date: Jan 2009
Location: USA
Posts: 804
Thanks: 168
Thanked 87 Times in 78 Posts
Default Re: How to make an html page PHP?

Quote:
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.
Quote:
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
Ashley Gable is offline   Reply With Quote
Old 06-09-2009, 12:34 AM   #10
Senior Warrior Member
War Room Member
 
mywebwork's Avatar
 
Join Date: Sep 2008
Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1
Thanks: 759
Thanked 724 Times in 505 Posts
Default Re: How to make an html page PHP?

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
mywebwork is offline   Reply With Quote
Old 06-09-2009, 05:23 AM   #11
Website Designer
War Room Member
 
robdraw's Avatar
 
Join Date: Jul 2008
Posts: 38
Thanks: 5
Thanked 2 Times in 1 Post
Contact Info
Send a message via Skype™ to robdraw
Default Re: How to make an html page PHP?

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

The most amazing wealth generation Package ever is up till 31st December
http://tinyurl.com/xmasblowoutsale
robdraw is offline   Reply With Quote
Old 06-09-2009, 12:14 PM   #12
Advanced Warrior
War Room Member
 
Ashley Gable's Avatar
 
Join Date: Jan 2009
Location: USA
Posts: 804
Thanks: 168
Thanked 87 Times in 78 Posts
Default Re: How to make an html page PHP?

Quote:
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
Ashley Gable is offline   Reply With Quote
Old 06-12-2009, 12:23 AM   #13
Senior Warrior
 
yaji's Avatar
 
Join Date: Oct 2007
Location: USA
Posts: 480
Blog Entries: 2
Thanks: 9
Thanked 4 Times in 4 Posts
Default Re: How to make an html page PHP?

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:

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

Thanks, Yaji (Offer to warriors only: Hosting at BEST companies, FREE for a year or 1 cent first month. PM me if interested. 30 or 45 days money back guarantee.)
Hypnosis Weight Loss Fun Info about Hypnosis Weight Loss | Cheap Car Insurance
Visit Mesothelioma: New Mesothelioma Info Disclosed
Cat Dandruff All about Cat Dandruff. A Must-Read for Cat Lovers
yaji is offline   Reply With Quote
Old 06-19-2009, 02:21 AM   #14
Banned
War Room Member
 
Join Date: Apr 2008
Location: , , .
Posts: 206
Thanks: 1
Thanked 12 Times in 11 Posts
Default Re: How to make an html page PHP?

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.
clubvikram is offline   Reply With Quote
Old 06-19-2009, 08:13 AM   #15
HyperActive Warrior
War Room Member
 
Join Date: Aug 2004
Location: , , .
Posts: 295
Thanks: 21
Thanked 15 Times in 11 Posts
Social Networking View Member's Twitter Profile 
Default Re: How to make an html page PHP?

Quote:
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.
Ken Shorey is offline   Reply With Quote
Old 06-19-2009, 04:23 PM   #16
HyperActive Warrior
War Room Member
 
rtrotter's Avatar
 
Join Date: Jun 2009
Location: Lubbock, Texas
Posts: 104
Thanks: 20
Thanked 34 Times in 29 Posts
Social Networking View Member's FaceBook Profile 
Default Re: How to make an html page PHP?

Quote:
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

Ping All Your Feed On Auto-Pilot
www.kping.com
rtrotter is offline   Reply With Quote
Old 06-22-2009, 09:22 AM   #17
HyperActive Warrior
War Room Member
 
Join Date: Aug 2004
Location: , , .
Posts: 295
Thanks: 21
Thanked 15 Times in 11 Posts
Social Networking View Member's Twitter Profile 
Default Re: How to make an html page PHP?

Quote:
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
Ken Shorey is offline   Reply With Quote
Old 06-22-2009, 09:50 AM   #18
Advanced Warrior
War Room Member
 
zoobie's Avatar
 
Join Date: Sep 2007
Location: hong kong
Posts: 933
Blog Entries: 2
Thanks: 3
Thanked 39 Times in 34 Posts
Default Re: How to make an html page PHP?

it's easy just use the ftp program to rename the file..
hopes that help

zoobie is offline   Reply With Quote
Old 06-26-2009, 08:44 AM   #19
Warrior Member
 
Join Date: Jun 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: How to make an html page PHP?

you need to know more HTML + CSS + JavaScript before you can use PHP

moreishi is offline   Reply With Quote
Old 06-28-2009, 01:05 AM   #20
Active Warrior
 
Join Date: May 2006
Location: Jacksonville,Florida , USA.
Posts: 99
Thanks: 6
Thanked 0 Times in 0 Posts
Social Networking View Member's FaceBook Profile 
Contact Info
Send a message via AIM to jeffsolochek Send a message via Yahoo to jeffsolochek Send a message via Skype™ to jeffsolochek
Default Re: How to make an html page PHP?

Save Your money. Get Netbeans which is free and use their help system both as regular lessons and Video How To's

jeffsolochek is offline   Reply With Quote
Old 07-01-2009, 01:14 AM   #21
Active Warrior
 
Noor Hayanah's Avatar
 
Join Date: Mar 2009
Posts: 29
Thanks: 6
Thanked 1 Time in 1 Post
Lightbulb Re: How to make an html page PHP?

Quote:
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.

Noor Hayanah is offline   Reply With Quote
Old 07-01-2009, 01:27 AM   #22
HyperActive Warrior
War Room Member
 
rtrotter's Avatar
 
Join Date: Jun 2009
Location: Lubbock, Texas
Posts: 104
Thanks: 20
Thanked 34 Times in 29 Posts
Social Networking View Member's FaceBook Profile 
Default Re: How to make an html page PHP?

Quote:
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

Ping All Your Feed On Auto-Pilot
www.kping.com
rtrotter is offline   Reply With Quote
Old 07-03-2009, 07:21 PM   #23
Enthusiastic Warrior
War Room Member
 
takingaction's Avatar
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 92
Thanks: 24
Thanked 18 Times in 18 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Default Re: How to make an html page PHP?

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:

Quote:
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.

takingaction is offline   Reply With Quote
Old 07-05-2009, 01:50 AM   #24
HyperActive Warrior
War Room Member
 
rtrotter's Avatar
 
Join Date: Jun 2009
Location: Lubbock, Texas
Posts: 104
Thanks: 20
Thanked 34 Times in 29 Posts
Social Networking View Member's FaceBook Profile 
Default Re: How to make an html page PHP?

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.

Ping All Your Feed On Auto-Pilot
www.kping.com
rtrotter is offline   Reply With Quote
Old 07-06-2009, 12:20 AM   #25
Enthusiastic Warrior
War Room Member
 
takingaction's Avatar
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 92
Thanks: 24
Thanked 18 Times in 18 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Default Re: How to make an html page PHP?

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.

takingaction is offline   Reply With Quote
Old 07-06-2009, 01:17 AM   #26
B.W
Warrior Member
 
Join Date: Jul 2009
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to make an html page PHP?

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.
B.W is offline   Reply With Quote
Old 07-06-2009, 04:48 PM   #27
Veteran Marketer
War Room Member
 
Jeremy Morgan's Avatar
 
Join Date: Jul 2009
Location: Portland, OR
Posts: 516
Blog Entries: 10
Thanks: 46
Thanked 80 Times in 51 Posts
Social Networking View Member's Myspace Profile  View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via ICQ to Jeremy Morgan
Default Re: How to make an html page PHP?

Quote:
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.

Jeremy Morgan, SEO / Internet Marketer
My Portland Web Design Firm
Check out my SEO Blog for news, tips and tutorials
Jeremy Morgan is offline   Reply With Quote
Old 07-09-2009, 05:05 AM   #28
Active Warrior
War Room Member
 
Join Date: Jul 2009
Posts: 56
Thanks: 2
Thanked 3 Times in 3 Posts
Default Re: How to make an html page PHP?

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
zain654321 is offline   Reply With Quote
Old 07-12-2009, 09:33 PM   #29
HyperActive Warrior
War Room Member
 
rtrotter's Avatar
 
Join Date: Jun 2009
Location: Lubbock, Texas
Posts: 104
Thanks: 20
Thanked 34 Times in 29 Posts
Social Networking View Member's FaceBook Profile 
Default Re: How to make an html page PHP?

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

Ping All Your Feed On Auto-Pilot
www.kping.com
rtrotter is offline   Reply With Quote
Old 07-13-2009, 09:26 AM   #30
Active Warrior
 
Join Date: Jul 2009
Posts: 63
Thanks: 6
Thanked 2 Times in 2 Posts
Default Re: How to make an html page PHP?

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.
josephalford is offline   Reply With Quote
Old 07-13-2009, 12:08 PM   #31
Chick Magnet
 
BurgerBoy's Avatar
 
Join Date: May 2009
Location: Kentucky, USA
Posts: 193
Thanks: 18
Thanked 22 Times in 19 Posts
Default Re: How to make an html page PHP?

Quote:
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

BurgerBoy is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
html, make, page, php

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 02:06 AM.