How to perform PHP code in the .html file?
ทำได้โดย .htaccess สำหรับ โฮสติ้ง directadmin
สำหรับท่านที่ ไม่อยากเปลี่ยน ไฟล์นามสกุล html ไปเป็น php โดยตรง เพราะกลัวเสีย seo
php works in mod_php mode
<IfModule dir_module> Addhandler application/x-httpd-php .php .htm .html .wml </IfModule>
แบบ php works in FastCGI mode
<FilesMatch "\.(html|htm)$"> AddHandler fcgid-script .php .html FCGIWrapper "/usr/local/safe-bin/fcgid53.sh" .htm FCGIWrapper "/usr/local/safe-bin/fcgid53.sh" .html </FilesMatch>
It does not work. The code is not executed. Files in the folder /usr/local/safe-bin/fcgid53.sh there.
หรือ
php5.3 FastCGI mode
<FilesMatch "\.(html|htm|php)$"> AddHandler fcgid-script .php .htm .html FCGIWrapper "/usr/local/safe-bin/fcgid53.sh" </FilesMatch>
php5.6 FastCGI mode
<FilesMatch "\.(html|htm|php)$"> AddHandler fcgid-script .php .htm .html FCGIWrapper "/usr/local/safe-bin/fcgid56.sh" </FilesMatch>