Page 1 of 1

PHP in index.html, Is it possible?

Posted: Wed Mar 03, 2004 10:00 am
by Joe
Hey, Recently I purchased some web space that supports PHP, ASP, mySQL, Perl etc, etc.. but my index page has to have a *.html extension. I want it so I can log users straight in if they have a cookie set which was produced by the site itself. Is it possible to do this with the index.html file?


Regards


Joe 8)

Posted: Wed Mar 03, 2004 10:02 am
by JayBird
you can get the server to parse html files aswel as PHP files.

Ask your provider.

Mark

hhmmmm

Posted: Wed Mar 03, 2004 10:03 am
by Joe
HHmmm, how would i go about doing that then. Is there any sites which tell me how to do it?

Regards


Joe 8)

Posted: Wed Mar 03, 2004 10:05 am
by Joe
Another way i thought was if i made the index.html file a redirection to index.php?

Posted: Wed Mar 03, 2004 10:08 am
by malcolmboston
i cannot see any reason why the host will allow you to use PHP everywhere EXCEPT your index page, i recommend you contact your host

Posted: Wed Mar 03, 2004 10:08 am
by JayBird
its in the apache configuration.

You can also do it in a .htaccess file by adding this line

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

(i think)

Mark

Posted: Wed Mar 03, 2004 10:10 am
by malcolmboston
thats exactly what i thought he meant bech but if your read closely :wink: its not, either it ain't or his explanation is incorrect

...

Posted: Wed Mar 03, 2004 10:11 am
by Joe
OK thanks guys. I will try some things out and if nothing works then I will be contacting my host!

Posted: Wed Mar 03, 2004 10:13 am
by code_monkey
what about using ssi's to achieve this, you could call a bit of php in to the html page as a server side include using the <!--#include virtual="file.php" --> and use it to generate whatever output you need. Normally you just need to create a .htaccess file to allow this.

Posted: Wed Mar 03, 2004 2:33 pm
by penguinboy
Bech100 wrote:its in the apache configuration.

You can also do it in a .htaccess file by adding this line

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

(i think)

Mark
That would any .html file to be parsed as a .php file.

Really what he needs is something like
(I never use .htaccess, but this is from httpd.conf file)

Code: Select all

DirectoryIndex index.html index.htm index.php

Posted: Wed Mar 03, 2004 10:05 pm
by infolock
penguinboy wrote:
Bech100 wrote:its in the apache configuration.

You can also do it in a .htaccess file by adding this line

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

(i think)

Mark
That would any .html file to be parsed as a .php file.

Really what he needs is something like
(I never use .htaccess, but this is from httpd.conf file)

Code: Select all

DirectoryIndex index.html index.htm index.php

would that really be so bad though? i mean, keeping it to where all htm/html files are parsed as php. it doesn't effect the html, and he may want to just use html extensions to hide the coding language he uses...