天空小小岛技术网站
标题:
Apache 加载 rewrite 后的一个 bug 及解决方案
[打印本页]
作者:
一粒米
时间:
2009-3-11 17:36
标题:
Apache 加载 rewrite 后的一个 bug 及解决方案
Apache 的 配置文件
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^(.*)/index.html$ $1/index.php
</VirtualHost>
复制代码
在 index.php 打印 $_SERVER['PHP_SELF']
访问
http://test.com/index.html
时
$_SERVER['PHP_SELF'] 为 /index.html
而我们希望得到的是 /index.php
解决方案:
<VirtualHost *:80>
<Directory />
RewriteEngine On
RewriteRule ^(.*)/index.html$ $1/index.php
</Directory>
</VirtualHost>
复制代码
欢迎光临 天空小小岛技术网站 (http://tkxxd.net/)
Powered by Discuz! X3.1