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

编程入门 行业动态 更新时间:2024-10-23 02:08:02
本文介绍了.htaccess问题:未指定输入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有人可以帮我吗?我感觉好像已经将我的头撞在墙上超过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-bit上,他们正在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?

PS.如果那很重要,那么CodeIgniter可以使用友好的URL.

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

Update1:​​

Update1:

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/index.php

Homepage also works when I request index.php directly: example/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. 请求example/index.php/start/(主页)或任何其他有效地址. 似乎Apache出于某种原因而没有转发查询.

I was wrong. Apache handles these URLs correctly. Requesting example/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:

www.example/something/ => www.example/index.php/something/ www.example/something/else/ => www.example/index.php/something/else/

www.example/something/ => www.example/index.php/something/ www.example/something/else/ => www.example/index.php/something/else/

推荐答案

我也很反对这一观点.我也在安装Code Igniter.

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

古怪的人不是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问题:未指定输入文件

本文发布于:2023-10-31 15:46:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546545.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!