Come posso fare in modo che i file .html vengano interpretati come file .php dal server?
In questo articolo, imparerai la procedura tramite la quale i file .html vengono interpretati come file .php dal server.
Passaggi del server condiviso
Affinché il server interpreti i file .html come file .php, è necessario aggiungere le righe sottostanti nel file .htaccess nella directory in cui si trova il file .html o nella directory principale dell'account di hosting.
AddHandler application/x-httpd-ea-php56-lsphp /opt/cpanel/ea-php56/root/usr/bin/lsphp .html
#AddHandler application/x-httpd-ea-php70-lsphp /opt/cpanel/ea-php70/root/usr/bin/lsphp .html
#application/x-httpd-ea-php71-lsphp /opt/cpanel/ea-php71/root/usr/bin/lsphp .html
#application/x-httpd-ea-php72-lsphp /opt/cpanel/ea-php72/root/usr/bin/lsphp .html
Decommenteremo la riga specifica per la versione PHP impostata nell'account cPanel, nel nostro caso PHP 5.6.
Passaggi per il server VPS cPanel
#AddHandler application/x-httpd-ea-php56 /opt/cpanel/ea-php56/root/usr/sbin/php-fpm .html
AddHandler application/x-httpd-ea-php70 /opt/cpanel/ea-php70/root/usr/sbin/php-fpm .html
#AddHandler application/x-httpd-ea-php71 /opt/cpanel/ea-php71/root/usr/sbin/php-fpm .html
#AddHandler application/x-httpd-ea-php72 /opt/cpanel/ea-php72/root/usr/sbin/php-fpm .html
Decommenteremo la riga specifica per la versione PHP impostata nell'account cPanel, nel nostro caso PHP 7.0.