I added the following line to .htaccess
:
AddType applica开发者_C百科tion/x-httpd-php .html .htm
When I try to load any page on the side, my browser tries to DOWNLOAD the page! What am I doing wrong?
Thanks!
Most likely; you don't have the PHP module loaded for your webserver. This means that then the server finds a application/x-httpd-php file, it passes it directly to the client instead of running it through a PHP interpretor (which would run any PHP code and output a text/html content type). Since browsers don't include PHP interpretors, they treat it as any other unknown content type, and offer to save it to disc.
HTML documents should be served to browser as text/html
. Change your MIME type.
AddType text/html .html .htm
If you're trying to execute HTML files as PHP, you should change the file extension to *.phtml.
- *.html - HTML content
- *.php - PHP content
- *.phtml - HTML content with embedded PHP scripts
If you're trying to force the PHP parser to work on these file types, you should be editing the httpd.conf
file on Apache to include the application/x-httpd-php
MIME type for those file extensions.
精彩评论