Reputation: 615
When I try to embed PHP into an HTML file, it doesn't work. I edited my .htaccess so that it treats HTML files as PHP, but when I try to visit the .html file my browser downloads it instead of parsing and displaying it.
EDIT: My .htaccess contents:
AddType application/x-httpd-php .html
Upvotes: 2
Views: 1731
Reputation: 5199
Try:
AddType application/x-httpd-php .php .html
RemoveHandler .php .html
<FilesMatch "\.(php|html)$">
SetHandler x-httpd-php
</FilesMatch>
EDIT:
Depending on your host, you may need to modify it a bit such as:
AddType application/x-httpd-php5 .php .html
RemoveHandler .php .html
<FilesMatch "\.(php|html)$">
SetHandler x-httpd-php5
</FilesMatch>
OR
AddType php5-script .php .html
RemoveHandler .php .html
<FilesMatch "\.(php|html)$">
SetHandler php5-script
</FilesMatch>
Upvotes: 4