htaccess的问题:没有指定输入文件 [英] .htaccess problem: No input file specified
问题描述
有人可以帮助我。我感觉就像我一直在打我的头撞墙超过2小时了。
Can someone help me with this. I'm feeling like I've been hitting my head against a wall for over 2 hrs now.
我已经得到的Apache 2.2.8 + PHP 5.2.6安装在我的机器上,用code中的.htacces以下工作正常,没有错误。
I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htacces with 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]
我的托管服务提供商的服务器上相同的code给了我一个404错误code,只输出:未指定输入文件。 index.php文件是存在的。我知道他们已经安装的Apache(找不到版本信息的任何地方),他们正在运行PHP v5.2.8。
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.
我在Windows XP 64位,他们正在运行一些Linux使用PHP的CGI / FastCGI的模式。任何人都可以提出可能是什么问题?
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。如果这是非常重要的是为codeIgniter与友好的URL来工作。
PS. if that's important that's for CodeIgniter to work with friendly URLs.
UPDATE1:
mod_rewrite的安装和。
mod_rewrite is installed and on.
我已经注意到的是,如果我在重写规则更改为/index.php?$1(问号代替正斜杠)它进入一个无限循环。总之,用问号是不是一种选择,因为codeIgniter(必需)是不会以这种方式工作。
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.
首页也适用,当我要求的index.php直接:example.com/index.php
Homepage also works when I request index.php directly: example.com/index.php
我开始认为这可能是,一旦斜线添加它不是一个文件了,但一个文件夹的Apache思考。如何改变这样的行为?
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?
更新2:
我错了。
阿帕奇正确处理这些URL。
请求 http://example.com/index.php/start/ (主页)或任何其他有效地址的作品。
看来,阿帕奇只是不转发查询出于某种原因。
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.
更新3:
只是要清楚我想要实现的。
我想改写这样的地址:
http://www.example.com/something/ =>的 http://www.example.com/index.php/something/
http://www.example.com/something/else/ => <一个href="http://www.example.com/index.php/something/else/">http://www.example.com/index.php/something/else/
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/
推荐答案
我打我的头反对这一点。我还安装code点火。
I was beating my head up against this as well. I'm also installing Code Igniter.
在goocher没有的RewriteBase。这是我的.htaccess:
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]
这篇关于htaccess的问题:没有指定输入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!