[原创]用Apache的mod_rewrite模块隐藏.PHP扩展名
fzjw 2005-05-21 09:44:34 <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样式均不能显示,加上\.一切正常。