php - 如何执行扩展名为.html的php文件?

标签 php .htaccess mod-rewrite url-rewriting webserver

我的网站有问题,当我尝试将 php 转换为 html 时,出现此错误 未找到

这是 .htaccess

RewriteEngine on
RewriteRule ^(.*)\.php$ /ver1/$1.html [R=301,QSA,L]

文件夹 ver1 中的所有文件

我看到这篇文章

.php url to .html url

但不和我一起工作

我只需要将 php 转换为 html,如果我转到index.php

我转到index.html并将所有url设为html

最佳答案

将 .php 文件重命名为 .html 并将此行添加到 .htaccess

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

关于php - 如何执行扩展名为.html的php文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12292754/

相关文章:

php - Yii2:如何使用mysql在Find()的orderby()中添加两个字段和NULLS LAST

mod-rewrite - Mango 博客的 URL 重写问题(404 错误)

php - jQuery 如何捕获 PHP 响应?

php - Doctrine2一对一正确完成

php - CSV 导入;所有值都是一行

.htaccess - htaccess 删除 URL 中间的任何内容(缩略图到图像 src)

css - 字体在 Firefox 的索引页面上不起作用

apache - http 到 https 给出重定向循环错误

apache - vue项目中如何将所有www流量重定向到非www网址

php - 如何将子域重写为 URL 中的变量?