[原创]用Apache的mod_rewrite模块隐藏.PHP扩展名
<VirtualHost *:80>
ServerAdmin webmaster@test.com
ServerName www.test.com
DocumentRoot /wwwroot/test/
DirectoryIndex index.php index.html
RewriteEngine on
#将所有*.php的文件扩展名去掉,剩下*.
RewriteRule ^(.*)\.$ $1\.php
</VirtualHost>
http://www.test.com/index.php?id=1
重写为
http://www.test.com/index.?id=1
如果
RewriteRule ^(.*)$ $1\.php
则可以通过http://www.test.com/index来访问index.php
我在Apache 1.3.33下测试,发现所有的CSS样式均不能显示,加上\.一切正常。
ServerAdmin webmaster@test.com
ServerName www.test.com
DocumentRoot /wwwroot/test/
DirectoryIndex index.php index.html
RewriteEngine on
#将所有*.php的文件扩展名去掉,剩下*.
RewriteRule ^(.*)\.$ $1\.php
</VirtualHost>
http://www.test.com/index.php?id=1
重写为
http://www.test.com/index.?id=1
如果
RewriteRule ^(.*)$ $1\.php
则可以通过http://www.test.com/index来访问index.php
我在Apache 1.3.33下测试,发现所有的CSS样式均不能显示,加上\.一切正常。
...全文
相关推荐
php检测apache mod_rewrite模块是否安装的方法
本文实例讲述了php检测apache mod_rewrite模块是否安装的方法。分享给大家供大家参考。具体实现方法如下: /** * @title Check if Apache's mod_rewrite is installed. * * @author Pierre-Henry Soria <ph7software> * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved. * @return boolean */ function isRewriteMod() { if (fun
开启Apache mod_rewrite模块示例代码
主要介绍了如何开启Apache mod_rewrite模块,需要的朋友可以参考下
apache中通过mod_rewrite实现伪静态页面的方法
mod_rewrite是Apache的一个非常强大的功能,它可以实现伪静态页面。下面我详细说说它的使用方法!对初学者很有用的哦!
Apache mod_rewrite中的REQUEST_URI使用实例
主要介绍了Apache mod_rewrite中的REQUEST_URI使用实例,本文使用一个实例讲解如何使用REQUEST_URI,需要的朋友可以参考下
PHP伪静态Rewrite设置之APACHE篇
Rewirte主要的功能就是实现URL的跳转和隐藏真实地址,基于Perl语言的正则表达式规范。平时帮助我们实现拟静态,拟目录,域名跳转,防止盗链等


基础编程
