Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess - parsing php into html

I recently played with a .htaccess file to make one server to parse PHP files. Yesterday I uploaded the same .htaccess file and tried to test a PHP file. But something went wrong: visiting my page the browser offers to download the the html page rather then viewing the page!

On the server the filenames end in .html.

I added the following to my .htaccess file:

AddType application/x-httpd-php .html

I tried to find the htaccess file, but once uploaded it just disappears from the root dir. I tried to upload other scripts I've found browsing. I even tried to search for some problem on a hosting forum. Nothing helped. Please help!

like image 498
Roko C. Buljan Avatar asked Mar 23 '26 16:03

Roko C. Buljan


1 Answers

Try this

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

OR

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

And remove other overriding handlers for application/x-httpd-php after above code.

like image 175
Ish Avatar answered Mar 25 '26 05:03

Ish