php使用htaccess获取路径信息


php get path info with htaccess

这是我的index.php文件:

<?php
echo $_SERVER['PATH_INFO'];
?>

这是我的htaccess文件:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /something
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

如果我输入了/index.php/hello,结果可能是/hello
但如果我说了什么/你好,它会说
未定义的索引:第3行/Library/WebServer/Documents/xcart/index.php中的PATH_INFO
如何获得相同的结果?

try:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^/(.*)/?$ something/$1
</IfModule>