我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

用.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

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.

Try this:

RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]

近期文章

  • 每个用变量键获取一个值
  • Php:如何剪切字符串的特定部分? [关闭]
  • 我目前有一个MYSQL语法错误
  • 在客户端计算机中创建文件
  • 使用php从数组中获取值
  • Laravel 5模型访问器方法不起作用
  • Elephant.io客户端无法正常工作
  • preg_split意外行为
  • 从URL末尾删除字符
  • Laravel文件上传NotFoundHttpException
  • 转换UTF字符但仅限于
  • LDAP绑定似乎返回true,空密码
  • 将SELECT @ variable从SQL发送到PHP
  • 我如何在文本数据库中强制换行?
  • Apache / Wamp / php问题? Chrome显示关闭php标签?>
  • MySql可以插入值[重复]
  • 会话变量($ _ SESSION)是否需要任何类型的清理
  • 可以使用正则表达式来验证一系列特定数字以外的数字吗?
  • 使用SHA2,mcrypt_create_iv,salt和MD5从PHP存储MySQL中的密码
  • PHP包含对TwitterOAuth.php不起作用,但是当我直接复制并粘贴其内容时,一切都很好

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华