天空小小岛技术网站

标题: Apache 加载 rewrite 后的一个 bug 及解决方案 [打印本页]

作者: 一粒米    时间: 2009-3-11 17:36
标题: Apache 加载 rewrite 后的一个 bug 及解决方案
Apache 的 配置文件

  1. <VirtualHost *:80>
  2. RewriteEngine On
  3. RewriteRule ^(.*)/index.html$ $1/index.php

  4. </VirtualHost>
复制代码
在 index.php 打印 $_SERVER['PHP_SELF']

访问  http://test.com/index.html

$_SERVER['PHP_SELF'] 为 /index.html

而我们希望得到的是 /index.php


解决方案:

  1. <VirtualHost *:80>
  2. <Directory />
  3. RewriteEngine On
  4. RewriteRule ^(.*)/index.html$ $1/index.php
  5. </Directory>
  6. </VirtualHost>
复制代码





欢迎光临 天空小小岛技术网站 (http://tkxxd.net/) Powered by Discuz! X3.1