【发布时间】:2010-06-03 03:36:04
【问题描述】:
我在 localhost 上有一个目录结构如下:
testing内部存在如下目录结构:
/testing/public
/testing/public/index.php
/testing/public/img
/testing/public/css
..etc for the js and swf directories
testing文件夹中有一个.htaccess文件,内容如下:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /testing/
RewriteRule ^public$ public/ [R,QSA]
RewriteRule ^public/$ public/index.php?state=public [L,QSA]
RewriteRule ^stackoverflow$ stackoverflow/ [R,QSA]
RewriteRule ^stackoverflow/$ public/index.php?state=stackoverflow[L,QSA]
我正在使用 PHP,并且在 /testing/public/index.php 文件中我想测试 $_GET['state'] 确实在保存变量。
当我尝试测试时:
http://localhost/testing/public
$_GET['state'] 根本找不到但是
http://localhost/testing/stackoverflow
确实表明 $_GET['state'] 等于 'stackoverflow'。
我在这里错过了什么???为什么我无法在第一个链接中获得 state=public ?感谢您的帮助!
【问题讨论】:
标签: .htaccess mod-rewrite