dqoqnmb163241 2009-09-09 13:57
浏览 63
已采纳

重定向问题“未指定输入文件”

I'm working on a url shortner script. It's located at http://mini.ample.se/ and the short URL will look something like http://mini.ample.se/[abc..]

my .httaccess file looks like this

<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>

when I try it out with ex. mini.ample.se/a I get "No input file specified" error. I know it got something to do with the redirecting and not finding my redirect.php file but I'm not sure what.

redirect.php file looks like this

$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);

Thanks!

  • 写回答

2条回答 默认 最新

  • duanjiaopi8218 2009-09-09 17:34
    关注

    I'm pretty sure this is a 'file not found' issue, that the php file is not found and its kicking back an error, I think your rewrite needs to have a condition that will not 'rewite' a certain request:

    RewriteCond $1 !^(redirect\.php)
    

    $1 being the value of course that is being passed.. just an example but I believe this is whats happening. Give it a try.

    EDIT: Did a search, looks like this could help you: http://jenseng.com/archives/000035.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢