user522401
user522401

Reputation: 91

Run single .html file as .php?

I have a contact form on a site with an .html extension that needs to be run as .php. I know you can use mod rewrite to treat all .html files as .php, but can you do it for just one file?

TIA...

Steve

Upvotes: 0

Views: 206

Answers (3)

Eray
Eray

Reputation: 7128

http://www.php.net/manual/en/security.hiding.php

If you want to do this for only one file , you have to set a unique extension (like .xyz) . If you choose .html all .html files executes as a PHP file.

Upvotes: 0

Harmen
Harmen

Reputation: 669

 <Files bar.html>
 SetHandler php-script
 </Files>

or something similar in either a .htaccess or your apache config.

Upvotes: 2

hangy
hangy

Reputation: 10859

If you use Apache, try to add this to your .htaccess:

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

(courtesy kavoir.com)

Upvotes: 1

Related Questions