Parsing HTML files as PHP

后端 未结 3 1101
旧时难觅i
旧时难觅i 2020-11-30 15:35

Is this the correct way to parse html files as php?

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

Saved in a .ht

3条回答
  •  清歌不尽
    2020-11-30 16:24

    Yes, if your webserver is running php as Apache module.

    If your webserver is running PHP as CGI, use this instead:

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

    Or, you could use this simple rewrite rule:

    RewriteEngine on 
    RewriteRule ^(.*)\.html $1\.php
    

提交回复
热议问题