doubian0284 2015-05-11 08:50
浏览 21
已采纳

用.htaccess重写php的html文件

I need help with converting html with php .

So far My code is

RewriteEngine on 
RewriteRule ([a-z]+).html /$1.php 

This is working fine. but some real html pages have php scripts ,that doesnt run. how to fix this? thanks

  • 写回答

2条回答 默认 最新

  • douduan5753 2015-05-11 08:56
    关注

    You can use AddHandler directive to change the mime type of a file

    Add the following line to your htaccess file

    AddHandler application/x-httpd-php .html
    

    Now all your html files will work as php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?