parsing HTML as PHP with Htaccess

1

I have a html site and I want HTML pages to be parsed as php; I'm using a .htaccess file for this.

On the localhost server, it works correctly. The command is:

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

However, the online server does not work. When I access the page, it asks you to download the file instead of displaying the page.

I'm using PHP 5.5 the Apache and Apache Version 2.4.10  I have several php inside the html more so I would have to change all the pages to .php more would give a lot of work so I want to leave everything with .html more executing the includes but only that the code does not work on the online server

I've tried all sorts of similar commands in htaccess, like:

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

  • AddType application / x-httpd-php5 .html .htm

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

  • AddHandler application / x-httpd-php5 .html .htm

  • AddHandler x-mapp-php .html .htm

  • AddHandler x-mapp-php5 .html .htm

But no luck.

I've also tried

  • RemoveHandler .html .htm but without success.

I checked the server if the .htaccess is active and it tested a code and it worked normal the problem is in the same code

    
asked by anonymous 09.02.2016 / 23:26

1 answer

0

Edit or create the file named .htaccess within the directory where the html files are located and enter the following command:

For linux servers SuPHP: AddHandler php-script html

For non-SuPHP linux servers: AddType application/x-httpd-php .html

    
10.02.2016 / 00:20