我如何重写的.php使用的.htaccess规则为.html? [英] How do I rewrite .php to .html using .htaccess rules?

查看:92
本文介绍了我如何重写的.php使用的.htaccess规则为.html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

解决方案

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

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

您可以看看这篇文章:<一个href="http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html">http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html

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

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.

这篇关于我如何重写的.php使用的.htaccess规则为.html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆