我如何重写的.php使用的.htaccess规则为.html?重写、规则、htaccess、php

2023-09-02 00:44:42 作者:捡你不如捡破烂.

我想用的.php 扩展转换为的.html 延长的.htaccess 规则

这是我能够做到的,如果是的话,怎么办?

解决方案

  RewriteEngine叙述上
重写规则^(。*)。HTML $ $ 1.PHP [NC]
 

使用了mod_rewrite。 $ 1表示正则表达式的第一部分和[NC]表示不区分大小写。

您可以看看这篇文章:http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html

编辑: 删除一条线。你不需要,我认为。 此外,谈到我所做的。

linux下的php网站放到Windows服务器IIS下.htaccess文件伪静态规则转换

I want to convert .php extension to .html extension using .htaccess rules

Is this something I can do, and if so, how?

解决方案

RewriteEngine on
RewriteRule ^(.*).html$ $1.php [nc]

Uses mod_rewrite. $1 indicates first part of the regex and [nc] means not case sensitive.

You can take a look at this article: http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html

EDIT: Removed a line. You do not need that I think. Also, commented on what I did.