Click to See Complete Forum and Search --> : .htaccess problems
xc-runner
08-20-2008, 02:35 AM
I'm trying to make my html files accept php, suppoosedly this should work:
Add this to the .htaccess file and voila...but instead when you click on a link it askes you to download or save the html instead of the browser rendering it.
Anyone ever do this?
here's the code:
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php .php .htm
katgal
08-20-2008, 05:49 AM
If your server is running php5, the code is:
AddHandler application/x-httpd-php5 .htm
xc-runner
08-20-2008, 01:12 PM
Ahhh, i'm pretty sure it is, I'll give that a shot.
Could that have been why it changed what the browser wanted to do with the file? you know, save or download and not render it?
Thanks
J
digizan
08-20-2008, 04:29 PM
Could that have been why it changed what the browser wanted to do with the file? you know, save or download and not render it?Basically, yes.
Browsers don't use the file extension of a URI to determine file types. When a browser requests a web page, the web server sends a "Content-type" response header to the browser that specifies the MIME type.
As long as you added the correct MIME handler, you could even give your php files the extension .foo and all would be well (ex: AddType application/x-httpd-php .foo).
If the MIME type is incorrect or absent, the browser will usually either display the content as plain text or attempt to download the file. See http://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types#HTTP for more info.
Digi
katgal
08-20-2008, 04:30 PM
Not certain.... but I know I had the same problem at one point last year. I'm pretty sure it happened when my host upgraded to php5 and didn't tell me!