[Tutorial] Using PHP in HTML pages

Example of PHP code.

Moderator: Moderators

[Tutorial] Using PHP in HTML pages

Postby Greg on Sun Feb 27, 2005 7:45 pm

Hey,

A few years ago, I was still working in HTML, i had to update every page when there was a new link etc. Until I found the power of PHP. But, google had listed all my pages as page.html for php to work, i had to change it to .php.

If you were like me, and need to use php in .html pages, we have a solution.

This will probably not work if you don't use Apache.

Open up .htaccess in your site’s root folder. If it doesn’t exist, open up Notepad.

Add this to the file

Code: Select all
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html


Then save it as .htaccess and you are now ready to use php in html pages.

Greg

This work is licensed under a Creative Commons License
User avatar
Greg
Registered User
Registered User
 
Posts: 651
Joined: Wed Jul 07, 2004 3:20 pm
Location: Yorkshire, United Kingdom

Postby shorty114 on Mon Feb 28, 2005 4:57 am

Greg wrote:This will probably not work if you don't use Apache.


This won't work with anything except Apache, or some clone of Apache.

I believe there is some way to do this in PWS/IIS, but I don't use PWS/IIS so I don't know.
shorty114
Registered User
Registered User
 
Posts: 99
Joined: Wed Dec 15, 2004 10:45 pm
Location: Lost...

Postby Basilakis on Sun Apr 03, 2005 5:06 pm

Don't do that.... Because anyone with a litle phph or cgi could se your code!
Basilakis
Registered User
Registered User
 
Posts: 113
Joined: Sat Oct 09, 2004 4:40 pm

Postby jleagle on Wed May 25, 2005 12:03 pm

is that really such a bad thing, unless obviously its a security risk (logins)
User avatar
jleagle
Registered User
Registered User
 
Posts: 7
Joined: Fri Feb 25, 2005 11:29 pm

Postby MarioFireGamer on Thu Feb 09, 2006 2:13 pm

they could also see mysql data
MarioFireGamer
banned
banned
 
Posts: 359
Joined: Tue Dec 13, 2005 2:21 pm

????

Postby freeadnetwork on Wed Jul 16, 2008 4:32 am

Can any body help me for that how
will it work if i m using windows server...
Journalism College - MIT - ISBJ offers courses in journalism like Post graduation courses and M.A in Masters of Journalism.
freeadnetwork
Registered User
Registered User
 
Posts: 3
Joined: Wed Jul 16, 2008 4:22 am


Return to PHP Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest