Go Back   WarriorForum - Internet Marketing Forums > The Warrior Forum > Main Internet Marketing Discussion Forum
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 08-09-2008, 01:33 PM   #1
Active Warrior
 
Join Date: Apr 2007
Location: , , Ireland.
Posts: 92
Thanks: 0
Thanked 3 Times in 3 Posts
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   Reply With Quote
Old 08-09-2008, 01:36 PM   #2
Spartan Warrior
War Room Member
 
Join Date: Jul 2008
Location: PH
Posts: 903
Thanks: 122
Thanked 144 Times in 72 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   Reply With Quote
Old 08-09-2008, 01:37 PM   #3
Warrior
War Room Member
 
Dennis Wagoner's Avatar
 
Join Date: Sep 2003
Location: USA
Posts: 568
Thanks: 30
Thanked 24 Times in 16 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Yahoo to Dennis Wagoner Send a message via Skype™ to Dennis Wagoner
Default

Hi Dave,

Hope this helps..

ONLamp.com -- Embedding PHP in HTML


Dennis

Dennis Wagoner is offline   Reply With Quote
Old 08-09-2008, 01:42 PM   #4
Active Warrior
 
Join Date: Apr 2007
Location: , , Ireland.
Posts: 92
Thanks: 0
Thanked 3 Times in 3 Posts
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   Reply With Quote
Old 08-09-2008, 02: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   Reply With Quote
Old 08-09-2008, 03:38 PM   #6
Donald VanFossen
War Room Member
 
zerofill's Avatar
 
Join Date: May 2008
Location: Upstate NY , USA.
Posts: 1,996
Thanks: 271
Thanked 354 Times in 173 Posts
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.



Commission Jacker - Everything is about to change!
zerofill is online now   Reply With Quote
Old 08-09-2008, 03:40 PM   #7
HyperActive Warrior
War Room Member
 
MoaddinFM's Avatar
 
Join Date: Apr 2008
Location: Germany
Posts: 208
Thanks: 1
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   Reply With Quote
Old 08-18-2008, 06:19 AM   #8
Active Warrior
 
Join Date: Apr 2007
Location: , , Ireland.
Posts: 92
Thanks: 0
Thanked 3 Times in 3 Posts
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   Reply With Quote
Old 08-18-2008, 07:47 AM   #9
Drunken Greek
War Room Member
 
BIG Mike's Avatar
 
Join Date: Dec 2004
Posts: 9,630
Blog Entries: 1
Thanks: 1,847
Thanked 3,671 Times in 1,070 Posts
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   Reply With Quote
Old 09-09-2008, 08:17 PM   #10
The Earl of Marketing
War Room Member
 
erday's Avatar
 
Join Date: Oct 2007
Location: Pacific, MO. USA.
Posts: 40
Thanks: 4
Thanked 4 Times in 4 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   Reply With Quote
Old 09-10-2008, 11:18 PM   #11
Advanced Warrior
War Room Member
 
Join Date: Jul 2002
Location: , , Australia.
Posts: 746
Thanks: 0
Thanked 35 Times in 7 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   Reply With Quote
Old 09-10-2008, 11:22 PM   #12
John Schwartz
War Room Member
 
Zeus66's Avatar
 
Join Date: Jul 2008
Location: Near Dallas, TX, USA
Posts: 3,691
Thanks: 1,620
Thanked 3,245 Times in 1,140 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
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 offline   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 11:00 AM.