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

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条