我正在处理一个url缩写脚本。 它位于http://mini.ample.se/ 和短URL看起来像http://mini.ample.se/[abc..]重定向问题“没有指定输入文件”
我.httaccess文件看起来像这样
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions MaxRedirects=1
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-zA-Z0-9_-]+)$ redirect.php?alias=$1 [L]
</IfModule>
当我尝试它与前。 mini.ample.se/a我得到“没有指定输入文件”的错误。 我知道它与重定向有关,并没有找到我的redirect.php文件,但我不知道是什么。
redirect.php文件看起来像这样
$alias = trim(mysql_real_escape_string($_GET['alias']));
if (!preg_match("/^[a-zA-Z0-9_-]+$/", $alias)) {
header("Location: ".SITE_URL, true, 301);
exit();
}
if (($url = get_url($alias))) {
header("Location: $url", true, 301);
exit();
}
header("Location: ".SITE_URL, true, 301);
谢谢!
不应该是'/redirect.php?...'带有斜杠? – bobince 2009-09-09 14:21:50
我也这么认为,但在我的服务器上,我有这个奇怪的问题,它只在没有引导斜线时才起作用!仍然无法弄清楚为什么:S – zanbaldwin 2009-09-09 14:37:34