.htaccess 问题:未指定输入文件 [英] .htaccess issues: 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
并且带有以下代码的 .htaccess
工作正常,没有错误.>
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]
我的托管服务提供商服务器上的相同代码给了我一个 404 错误代码并输出 only: No input file specified.
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 位
,他们在 CGI/FastCGI<中使用
PHP
运行一些 Linux
/代码> 模式.任何人都可以建议可能是什么问题?
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?
附注.如果这对 CodeIgniter
使用友好的 URL 很重要.
PS. if that's important that's for CodeIgniter
to work with friendly URLs.
更新 1:
mod_rewrite
已安装并打开.
我注意到,如果我将 RewriteRule
更改为 /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:
我错了.
Apache 正确处理这些 URL.
请求 http://example.com/index.php/start/
(主页)或任何其他有效地址都有效.
似乎 Apache
只是出于某种原因没有转发查询.
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:
只是为了清楚我想要实现的目标.
我想重写这样的地址:
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 Igniter.
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屋!