dongmi1221 2009-10-12 22:19
浏览 222
已采纳

.htaccess问题:未指定输入文件

Can someone help me with this? I'm feeling like I've been hitting my head against a wall for over 2 hrs now.

I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htaccess with the code below works fine, no errors.

RewriteEngine on
RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

The same code on my hosting provider server gives me a 404 error code and outputs only: No input file specified. index.php is there. I know they have Apache installed (cannot find version info anywhere) and they're running PHP v5.2.8.

I'm on Windows XP 64-bit, they're running some Linux with PHP in CGI/FastCGI mode. Can anyone suggest what could be the problem?

PS. if that's important that's for CodeIgniter to work with friendly URLs.


Update1:

mod_rewrite is installed and on.

What I've noticed is that if I change in RewriteRule to /index.php?$1 (question mark instead of forward slash) it goes into an infinite loop. Anyway, using question mark isn't an option as CodeIgniter (required) is not going to work this way.

Homepage also works when I request index.php directly: example.com/index.php

I'm starting to think it might be apache thinking that once the trailing slash is added it is not a file anymore but a folder. how to change such a behaviour?


Update 2:

I was wrong.
Apache handles these URLs correctly.
Requesting http://example.com/index.php/start/ (homepage) or any other valid address works.
Seems that Apache is just not forwarding the query for some reason.


Update 3:

Just to be clear what I'm trying to achieve.
I want to rewrite addresses like that:

http://www.example.com/something/ => http://www.example.com/index.php/something/ http://www.example.com/something/else/ => http://www.example.com/index.php/something/else/

  • 写回答

12条回答 默认 最新

  • dsvbtgo639708 2009-10-14 20:53
    关注

    I was beating my head up against this as well. I'm also installing Code Igniter.

    The goocher was no RewriteBase. Here's my .htaccess:

    DirectoryIndex index.php
    
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|robots\.txt)
    
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(11条)

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退