tags:

views:

29

answers:

1

Hi all,

How can I rewrite file extension, so when file have extension html, Apache thinks that is php extension?

I need it because I have to install some PHP application, which contains HTML files with PHP code in it...

Tryed with .htaccess:

RewriteEngine On
RewriteBase /
RewriteRule  ^(.*).html$ $1.php [R=301]

... but no luck.

Thank you in advance!

+4  A: 

Try this:

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

in your .htaccess

n3rd
Nope, still have the same. I call URL: http://myserver.com/item/3827.html, and getting error: Fatal error: Call to undefined function: mysql_connect()
Well, that means it's being parsed as PHP so the question you originally asked is answered :-)
n3rd
But if file extension is php, function mysql_connect works fine. It returns error if file is with extension html. To me, it looks it is not parsed as php.
If it wasn't parsed as PHP, mysql_connect wouldn't throw an error as it wouldn't even be recognized as as a PHP function call.As to why it works with a .php but not with an .html extension, I have no clue. You should probably ask this as a new question, though.
n3rd