Forum Moderators: coopster

Message Too Old, No Replies

Parsing HTML as PHP files

browser asks for file download when a page is accessed

         

gperrones

2:05 pm on May 2, 2003 (gmt 0)

10+ Year Member



Hi,

I'm having trouble adding .html to the list of extensions parsed thru the php parser using .htaccess.

Whenever I add the line:
AddType application/x-httpd-php .html

or

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

to the .htaccess file, the pages become inaccessible. I get a browser box prompting for a file download.

Could someone give a little help? I'm not the most technical webmaster.

Thanks in advance.

gperrones

ncsuk

2:10 pm on May 2, 2003 (gmt 0)

10+ Year Member



Can you not parse in the .htaccess file something that leaves the pages as .html but treats them as if they are .php pages.

Ill go investigate and try to find the code for it brb.

ncsuk

2:12 pm on May 2, 2003 (gmt 0)

10+ Year Member



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

That should do it basically take the php bit off the end of what you have already.

gperrones

3:10 pm on May 2, 2003 (gmt 0)

10+ Year Member



Thank you, NCSUK, for the reply, but it still doesn't work. Same message, asking for a file download.
:(

I know the code you gave me works perfectly, I've already done that on other sites, but this particular hosting company has some kind of bug with it.

Is there another option or someone has a clue about what is misconfigured?

Thanks.

WibbleWobble

3:14 pm on May 2, 2003 (gmt 0)

10+ Year Member



Is it a Zeus webserver, or something else that isn't Apache? I've seen this on non-apache servers, the most recent of which was Zeus.

gperrones

3:22 pm on May 2, 2003 (gmt 0)

10+ Year Member



It says Apache/1.3.27 (Unix) FrontPage/5.0.2.2510 mod_jk/1.1.0 when doing a phpinfo command, running under FreeBSD.

ncsuk

3:29 pm on May 2, 2003 (gmt 0)

10+ Year Member



Are the frontpage extensions configured properly?

(If you are using a frontpage site *God forbid)

gperrones

5:35 pm on May 2, 2003 (gmt 0)

10+ Year Member



No,I'm not using Frontpage. The server has the Frontpage extensions instaled, but they're disabled on the admin control panel.

BCMG_Scott

1:57 pm on May 5, 2003 (gmt 0)

10+ Year Member



From your last statement I am guessing that this is a shared server owned by a hosting company and not your own. It's possible that they are not allowing the AddType command override in your local .htaccess file.

Another issue (perhaps just a personal peeve), but you shouldn't be parsing .html and .htm as php. This means that EVERY .html and .htm page will be parsed by the server regardless of whether it has php in it or not. This will add load and overhead to each page/process. Personally I stick .html and .htm as plain static HTML pages, and run .php .phtml and .php3 as php parsed pages. Just my $0.02.

Scott

gperrones

9:20 pm on May 5, 2003 (gmt 0)

10+ Year Member



Scott,

Yes, it's a shared server. I decided to take the clean route and use .php only for parsed pages, leaving .html for the static content.

Anyway, thanks to all who replied.