I need help with converting html with php .
我需要帮助转换HTML与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
这工作正常。但是一些真正的html页面有php脚本,不会运行。怎么解决这个问题?谢谢
2 个解决方案
#1
You can use AddHandler directive to change the mime type of a file
您可以使用AddHandler指令更改文件的mime类型
Add the following line to your htaccess file
将以下行添加到htaccess文件中
AddHandler application/x-httpd-php .html
Now all your html files will work as php.
现在你所有的html文件都将作为php工作。
#2
Try this:
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]
#1
You can use AddHandler directive to change the mime type of a file
您可以使用AddHandler指令更改文件的mime类型
Add the following line to your htaccess file
将以下行添加到htaccess文件中
AddHandler application/x-httpd-php .html
Now all your html files will work as php.
现在你所有的html文件都将作为php工作。
#2
Try this:
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]