I have the included code in my .htaccess file but the php code I am attempting to include is not working.
Options +Includes
AddType text/html .htm .html
AddHandler server-parsed .htm .html
AddType application/octet-stream .vcf
AddOutputFilterByType DEFLATE text/html text/htm text/plain text/css text/php text/javascript application/x-javascript
To add the dynamic data (HTML content) at a certain point in PHP code, we need parsing. For example: For adding the data (info) in the form of HTML, we need to make that dynamic template in string and then convert it to HTML. How should we do parsing? We should use loadHTML() function for parsing.
PHP and HTML interact a lot: PHP can generate HTML, and HTML can pass information to PHP. Before reading these faqs, it's important you learn how to retrieve variables from external sources. The manual page on this topic includes many examples as well.
PHP support can be added to a number of web servers (IIS, Xitami, and so on), but most commonly Apache HTTP Server is used. Click here for information on how to install and configure Apache 2.2. The PHP engine. The supported version is PHP5.
Try:
AddType application/x-httpd-php .html .htm
UPDATE 1
It may be PHP version specific. If you're using PHP5 try:
AddType application/x-httpd-php5 .html .htm
UPDATE 2
Try:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Or here's yet another alternative way to do this:
<FilesMatch "\.html$">
ForceType application/x-httpd-php
</FilesMatch>
On Apache 2.2.22 (Ubuntu) with Php 5 add these lines to /etc/apache2/mods-enabled/php5.conf
<FilesMatch ".+\.html$">
SetHandler application/x-httpd-php
</FilesMatch>
and restart apache
sudo service apache2 restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With