Go Back   WarriorForum - Internet Marketing Forums > The Warrior Forum > Main Internet Marketing Discussion Forum

Reply
 
LinkBack Thread Tools
Old 08-09-2008, 12:33 PM   #1
Active Warrior
 
Join Date: Apr 2007
Location: , , Ireland.
Posts: 82
Thanks: 0
Thanked 1 Time in 1 Post
Default Can I put PHP in a HTML file?

Hi folks,

I've a script that will only work in php and the site I want to use it on has html files. I don't want to change the html files because I want to use the script to track traffic. My traffic for this site comes from the search engines, so I think that if I change the file name it may eventually affect rankings.

Does anyone know if -
Is there a way to put php into a html file?

Or alternatively, is there a way to keep my pages in the search engines but have some sort of redirect to a php file?

Thanks,
Dave
DavidMeade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2008, 12:36 PM   #2
Spartan Warrior
War Room Member
 
Join Date: Jul 2008
Location: PH
Posts: 704
Thanks: 59
Thanked 63 Times in 37 Posts
Default

You can make HTML run PHP lines, just put the following code in your .htaccess

AddType application/x-httpd-php .html


Mark Brian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2008, 12:37 PM   #3
Warrior
War Room Member
 
Dennis Wagoner's Avatar
 
Join Date: Sep 2003
Location: USA
Posts: 501
Thanks: 22
Thanked 14 Times in 7 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Yahoo to Dennis Wagoner
Default

Hi Dave,

Hope this helps..

ONLamp.com -- Embedding PHP in HTML


Dennis

Follow Me on Twitter
He who laughs last, thinks slowest.
Dennis Wagoner is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2008, 12:42 PM   #4
Active Warrior
 
Join Date: Apr 2007
Location: , , Ireland.
Posts: 82
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi IMB, Dennis,

I'll try those and post a quick note when I get them working.

Thanks a mill,
Dave
DavidMeade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2008, 01:00 PM   #5
Active Warrior
 
Hugh Fraser's Avatar
 
Join Date: Sep 2007
Location: United Kingdom.
Posts: 40
Thanks: 3
Thanked 0 Times in 0 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Default

Quote:
Originally Posted by Dennis Wagoner View Post
Hi Dave,

Hope this helps..

ONLamp.com -- Embedding PHP in HTML


Dennis
Hey,
This is one of those things I just not think was possible, but then again we are dealing with technology that changes daily, which is very cool, Thanks Dennis, I'll book mark this page.

Hugh

Hugh Fraser is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2008, 02:38 PM   #6
Donald VanFossen
War Room Member
 
zerofill's Avatar
 
Join Date: May 2008
Location: Upstate NY , USA.
Posts: 1,441
Blog Entries: 2
Thanks: 39
Thanked 119 Times in 57 Posts
Social Networking View Member's Twitter Profile 
Default

The .htaccess change will work. Just remember that all html files will now be parsed as PHP whether there is PHP code in them or not.

Come Visit Us at Don and Jeremy's Blog
zerofill is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-09-2008, 02:40 PM   #7
HyperActive Warrior
War Room Member
 
MoaddinFM's Avatar
 
Join Date: Apr 2008
Location: Germany
Posts: 200
Thanks: 0
Thanked 1 Time in 1 Post
Contact Info
Send a message via ICQ to MoaddinFM Send a message via Skype™ to MoaddinFM
Default

donīt forget to backup all your files, especially the htacces file before any changes.

Itīs common sense, I know. But as soon as you forget 1 time ... *Caboooom Crahs Bang bup*

Martin
MoaddinFM is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-18-2008, 05:19 AM   #8
Active Warrior
 
Join Date: Apr 2007
Location: , , Ireland.
Posts: 82
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: Can I put PHP in a HTML file?

Hi,

the code I put in my htaccess file is,

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

My php scripts work fine now in html and I haven't had any problems with it.

Dave
DavidMeade is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-18-2008, 06:47 AM   #9
Drunken Greek
War Room Member
 
BIG Mike's Avatar
 
Join Date: Dec 2004
Location: Greece
Posts: 8,535
Blog Entries: 1
Thanks: 703
Thanked 2,095 Times in 568 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via Skype™ to BIG Mike
Default Re: Can I put PHP in a HTML file?

And if your host is running PHP 5? Usually this will work:

AddType application/x-httpd-php5 htm html
AddHandler application/x-httpd-php5 .htm .html

Although you may need to ask them.

Another cool trick is to make all your files in PHP but use Apache's Rewrite Engine to output them at HTM or HTML file extensions

BIG Mike is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-09-2008, 07:17 PM   #10
The Earl of Marketing
 
erday's Avatar
 
Join Date: Oct 2007
Location: Pacific, MO. USA.
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Social Networking View Member's Twitter Profile 
Default Re: Can I put PHP in a HTML file?

"Here's A Quick And Easy Software Tool That Will Allow You To Use PHP Code Inside Your Ordinary HTML Web Pages it's called PHP Activator"

Download for Free! No you don't have to Opt-In just download.

Enjoy.

http://www.softwaregoldclub.com/gets...ivator_477.exe

More Free Advertising Than You Can Imagine!
http://4trafficnow.com
erday is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-10-2008, 10:18 PM   #11
Advanced Warrior
War Room Member
 
Join Date: Jul 2002
Location: , , Australia.
Posts: 702
Thanks: 0
Thanked 21 Times in 3 Posts
Default Re: Can I put PHP in a HTML file?

Quote:
Originally Posted by erday View Post
"Here's A Quick And Easy Software Tool That Will Allow You To Use PHP Code Inside Your Ordinary HTML Web Pages it's called PHP Activator"

Download for Free! No you don't have to Opt-In just download.

Enjoy.

http://www.softwaregoldclub.com/gets...ivator_477.exe
Nice... option...

But I would make a new php page and copy your old html in there... and then make your org html page redirect to the next php page...

Tom

ezimedia is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-10-2008, 10:22 PM   #12
Senior Warrior Member
War Room Member
 
Zeus66's Avatar
 
Join Date: Jul 2008
Location: Near Dallas, TX, USA
Posts: 2,198
Blog Entries: 23
Thanks: 665
Thanked 1,367 Times in 563 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via Skype™ to Zeus66
Default Re: Can I put PHP in a HTML file?

Quote:
Originally Posted by BIG Mike View Post
And if your host is running PHP 5? Usually this will work:

AddType application/x-httpd-php5 htm html
AddHandler application/x-httpd-php5 .htm .html
Man, I found this out the hard way! I use HostGator, and they run PHP 5. I could not for the life of me figure out why the PHP was acting screwy. Finally I found this answer... but it was after 3 days and lots of promises to quit forever and hack up my PC with an ax.

John

Zeus66 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > The Warrior Forum > Main Internet Marketing Discussion Forum

Tags
php, redirect

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:00 PM.