Toro 文档显示:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
但我尝试了很多次和不同的方式,但是,不起作用......经过大量搜索,我发现了这个(来源):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php?$1 [L]
只需要改变RewriteRule ^(.*)$ /index.php/$1 [L]
to /
,?
得到这个RewriteRule ^(.*)$ /index.php?$1 [L]
有人知道为什么原来的不起作用,或者有不同的方法吗?
更多信息 主机:php5.4 fastcgi,共享主机,公司 Dreamhost。只需接受 SCRIPT_NAME 而不是 PATH_INFO
处理它的 Toro 代码是:
$path_info = '/';
if (!empty($_SERVER['PATH_INFO'])) {
$path_info = $_SERVER['PATH_INFO'];
}
else if (!empty($_SERVER['ORIG_PATH_INFO']) && $_SERVER['ORIG_PATH_INFO'] !== '/index.php') {
$path_info = $_SERVER['ORIG_PATH_INFO'];
}
else {
if (!empty($_SERVER['REQUEST_URI'])) {
$path_info = (strpos($_SERVER['REQUEST_URI'], '?') > 0) ? strstr($_SERVER['REQUEST_URI'], '?', true) : $_SERVER['REQUEST_URI'];
}
}