使用mod_rewrite隐藏或更改页面扩展名 [英] Hide or Change page extension with mod_rewrite

查看:61
本文介绍了使用mod_rewrite隐藏或更改页面扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改我的所有php页面,使其在浏览器中显示为html页面?
他们将保存x.php文件时的文件名是什么?

how can i change all my php page to show as html page in the browser ?
What will be the file name when they will save a x.php file ?

推荐答案

尝试将以下内容放入网站主目录(public_html或www)或httpd.conf(或类似文件)中的.htaccess文件中.不在共享主机上,并且具有对服务器的root访问权:

Try putting the following in a .htaccess file at the main directory of your site (public_html or www), or httpd.conf (or similar) if you aren't on shared hosting and have root access to the server:

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

当有人尝试保存该页面时,该页面将另存为.html(他们永远不会知道它确实是.php文件!)

When someone tries to save the page, it will save as .html (they will never know it was really a .php file!)

这篇关于使用mod_rewrite隐藏或更改页面扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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