Page 1 of 1

.htm extension resolving to .php?

Posted: Thu Feb 02, 2006 10:41 am
by Col. Panic
I just discovered an error in a script - but it has been functioning nonetheless for years.

I'm using a script named club_store_parser.php. But I discovered that in another script I have a link to it as club_store_parser.htm (and there is no document with that name anywhere).

So, it'll call something like

../../club_store/club_store_parser.htm?page=club_store_detail&refer=shed&id=02500363

when it should really be

../../club_store/club_store_parser.php?page=club_store_detail&refer=shed&id=02500363

But it works just fine - I've tested it thoroughly.

I was wondering -- why is this? The browser can't find a file of that name with .htm, so it loads the one with .php?

Posted: Thu Feb 02, 2006 10:46 am
by josh
Several reasons

You could be mod_rewriting all .php to .htm, you could also have .htm as a PHP handled file (which would not affect normal .htm files except for overhead of parsing them for PHP). Your host could have also done this

Posted: Thu Feb 02, 2006 10:47 am
by feyd
it's likely the server recognizing that the extension is off and rewrites it.. or someone put a redirection into the server..

Posted: Thu Feb 02, 2006 11:08 am
by m3mn0n
Yeah... something like:
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .htm

# For PHP 4
Action application/x-httpd-php "/php/php.exe"

# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"