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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • dtlh12053 2015-05-11 08:55
    关注

    Try this:

    RewriteEngine On
    RewriteRule ^(.*)\.html$ $1.php [L]
    
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 帮电子新生画个仿真图吧🥰
  • ¥25 实验:WordCount案例实践(根据实验指导书编写实验报告。要求:文字加图)
  • ¥20 基于STM32F407设计一个贪食蛇游戏,要求:1有开始 、结束界面,能进行游戏设置,如:界面颜色,蛇移动速度。2蛇体能上下左右移动且在界面能随机生成食物,蛇吃后会变长;3小蛇碰壁死亡,显示游戏结束。
  • ¥15 摁摁钮(接P3.4口)无法实现点阵管播放速度调节,大家能帮我看看是什么问题吗?TAT
  • ¥15 小型网络防火墙mstp.vrrp.ospf配置
  • ¥15 grafna发送告警信息
  • ¥15 51单片机,LCD屏幕内容修改
  • ¥20 Ida Pro动态调试
  • ¥15 TensorFlow深度学习拓展项目
  • ¥20 springboot博客系统